Project

General

Profile

« Previous | Next » 

Revision e1aec1dc

Added by Tomer Brisker about 9 years ago

Fixes #9444 - prevent 404 error on current_parameters and domain_selected

View differences:

app/controllers/concerns/foreman/controller/host_details.rb
elsif params[:interface]
render :json => Subnet.authorized(:view_subnets)
else
not_found
render :json => {}
end
end
end
......
def assign_parameter(name, root = "")
taxonomy_scope
Taxonomy.as_taxonomy @organization, @location do
if params["#{name}_id"].to_i > 0 and instance_variable_set("@#{name}",name.classify.constantize.find(params["#{name}_id"]))
item = instance_variable_get("@#{controller_name.singularize}") || controller_name.classify.constantize.new(params[controller_name.singularize])
render :partial => root + name, :locals => { :item => item }
else
head(:not_found)
end
instance_variable_set("@#{name}",name.classify.constantize.where(:id => params["#{name}_id"]).first)
item = instance_variable_get("@#{controller_name.singularize}") || controller_name.classify.constantize.new(params[controller_name.singularize])
render :partial => root + name, :locals => { :item => item }
end
end

Also available in: Unified diff