Project

General

Profile

« Previous | Next » 

Revision 56309d5d

Added by Tom Caspy almost 9 years ago

fixes #9058 - interfaces should not be affected when changing loc/org

View differences:

app/controllers/hosts_controller.rb
def process_taxonomy
return head(:not_found) unless @location || @organization
@host = Host.new(params[:host].except(:interfaces_attributes))
@host = Host.new(clean_interfaces_attributes)
# revert compute resource to "Bare Metal" (nil) if selected
# compute resource is not included taxonomy
Taxonomy.as_taxonomy @organization, @location do
......
end
def template_used
host = Host.new(params[:host].except(:host_parameters_attributes, :interfaces_attributes))
host = Host.new(clean_interfaces_attributes.except(:host_parameters_attributes))
templates = host.available_template_kinds(params[:provisioning])
return not_found if templates.empty?
render :partial => 'provisioning', :locals => { :templates => templates }
......
end
end
end
def clean_interfaces_attributes
attributes = params[:host].dup
if params[:host][:interfaces_attributes]
attributes[:interfaces_attributes] = params[:host][:interfaces_attributes].dup.except(:created_at, :updated_at, :attrs)
attributes[:interfaces_attributes][:id] = nil
end
attributes
end
end

Also available in: Unified diff