[PATCH conductor 3/4] to_a was removed from the String class in ruby 1.9

Mo Morsi mmorsi at redhat.com
Wed May 2 13:48:53 UTC 2012


---
 src/app/controllers/application_controller.rb      |    4 ++--
 src/app/controllers/deployables_controller.rb      |    4 ++--
 .../controllers/hardware_profiles_controller.rb    |    2 +-
 src/app/controllers/images_controller.rb           |    2 +-
 src/app/controllers/instances_controller.rb        |    2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/app/controllers/application_controller.rb b/src/app/controllers/application_controller.rb
index 9b89d0e..57f4b6a 100644
--- a/src/app/controllers/application_controller.rb
+++ b/src/app/controllers/application_controller.rb
@@ -116,7 +116,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])
@@ -166,7 +166,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..c66aa82 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 = Array(params[:catalog_id])
       load_catalogs
       @selected_catalogs.each do |catalog_id|
         require_privilege(Privilege::CREATE, Deployable, Catalog.find_by_id(catalog_id))
@@ -117,7 +117,7 @@ class DeployablesController < ApplicationController
     end
 
     @deployable = Deployable.new(params[:deployable])
-    @selected_catalogs = Catalog.find(params[:catalog_id].to_a)
+    @selected_catalogs = Catalog.find(Array(Array(params[:catalog_id])))
     @deployable.owner = current_user
     @selected_catalogs.each do |catalog|
       require_privilege(Privilege::CREATE, Deployable, catalog)
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 d71c1b1..cf7dc1a 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 a70a196..ba9fa5b 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, at instance)
   end
 
-- 
1.7.6.5




More information about the aeolus-devel mailing list