--- src/app/controllers/application_controller.rb | 4 ++-- src/app/controllers/deployables_controller.rb | 2 +- .../controllers/hardware_profiles_controller.rb | 2 +- src/app/controllers/images_controller.rb | 2 +- src/app/controllers/instances_controller.rb | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/app/controllers/application_controller.rb b/src/app/controllers/application_controller.rb index db471ba..01b1bc6 100644 --- a/src/app/controllers/application_controller.rb +++ b/src/app/controllers/application_controller.rb @@ -115,7 +115,7 @@ class ApplicationController < ActionController::Base # Returns an array of ids from params[:id], params[:ids]. def ids_list(other_attrs=[]) other_attrs.each do |attr_key| - return params[attr_key].to_a if params.include?(attr_key) + return Array(params[attr_key]) if params.include?(attr_key) end if params[:id].present? return Array(params[:id]) @@ -165,7 +165,7 @@ class ApplicationController < ActionController::Base hash[:object] = ivar[1, ivar.size] hash[:errors] ||= [] val.errors.each {|key,msg| - arr.push([key, msg.to_a].to_a) + arr.push([key, Array(msg)].to_a) } hash[:errors] += arr end diff --git a/src/app/controllers/deployables_controller.rb b/src/app/controllers/deployables_controller.rb index 7d3d744..6916f09 100644 --- a/src/app/controllers/deployables_controller.rb +++ b/src/app/controllers/deployables_controller.rb @@ -38,7 +38,7 @@ class DeployablesController < ApplicationController @image = Aeolus::Image::Warehouse::Image.find(params[:create_from_image]) @hw_profiles = HardwareProfile.frontend.list_for_user(current_user, Privilege::VIEW) @deployable.name = @image.name - @selected_catalogs = params[:catalog_id].to_a + @selected_catalogs = Catalog.find(Array(Array(params[:catalog_id]))) load_catalogs @selected_catalogs.each do |catalog_id| require_privilege(Privilege::CREATE, Deployable, Catalog.find_by_id(catalog_id)) diff --git a/src/app/controllers/hardware_profiles_controller.rb b/src/app/controllers/hardware_profiles_controller.rb index 069e61f..dc19c13 100644 --- a/src/app/controllers/hardware_profiles_controller.rb +++ b/src/app/controllers/hardware_profiles_controller.rb @@ -42,7 +42,7 @@ class HardwareProfilesController < ApplicationController end
def show - @hardware_profile = HardwareProfile.find(params[:id].to_a.first) + @hardware_profile = HardwareProfile.find(Array(params[:id]).first) require_privilege(Privilege::VIEW, @hardware_profile) @title = if @hardware_profile.provider_hardware_profile? t('hardware_profiles.show.backend_hwp', :name => @hardware_profile.name) diff --git a/src/app/controllers/images_controller.rb b/src/app/controllers/images_controller.rb index cad12f9..e34b130 100644 --- a/src/app/controllers/images_controller.rb +++ b/src/app/controllers/images_controller.rb @@ -347,7 +347,7 @@ class ImagesController < ApplicationController end
def multi_destroy - selected_images = params[:images_selected].to_a + selected_images = Array(params[:images_selected]) selected_images.each do |uuid| image = Aeolus::Image::Warehouse::Image.find(uuid) @environment = PoolFamily.where('name' => image.environment).first diff --git a/src/app/controllers/instances_controller.rb b/src/app/controllers/instances_controller.rb index 7773d81..4be3a98 100644 --- a/src/app/controllers/instances_controller.rb +++ b/src/app/controllers/instances_controller.rb @@ -218,7 +218,7 @@ class InstancesController < ApplicationController private
def load_instance - @instance = Instance.find(params[:id].to_a.first) + @instance = Instance.find(Array(params[:id]).first) require_privilege(Privilege::USE,@instance) end