From 6cad85cec1df1ad88cff6e635c808bd54c9e30ee Mon Sep 17 00:00:00 2001 From: Matchu Date: Tue, 5 Mar 2013 15:41:55 -0600 Subject: [PATCH] iron out some rails 3.1 compatibility issues --- app/models/closet_hanger.rb | 2 +- app/models/pet.rb | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/models/closet_hanger.rb b/app/models/closet_hanger.rb index c3f29835..036e3626 100644 --- a/app/models/closet_hanger.rb +++ b/app/models/closet_hanger.rb @@ -16,7 +16,7 @@ class ClosetHanger < ActiveRecord::Base scope :alphabetical_by_item_name, lambda { joins(:item => :translations). where(Item::Translation.arel_table[:locale].eq(I18n.locale)). - order(Item.arel_table[:name]) + order(Item::Translation.arel_table[:name]) } scope :newest, order(arel_table[:created_at].desc) scope :owned_before_wanted, order(arel_table[:owned].desc) diff --git a/app/models/pet.rb b/app/models/pet.rb index 038b7e48..26d9ceb7 100644 --- a/app/models/pet.rb +++ b/app/models/pet.rb @@ -23,20 +23,20 @@ class Pet < ActiveRecord::Base I18n.with_locale(options[:locale]) do viewer_data = fetch_viewer_data - pet_data = OpenStruct.new(viewer_data.custom_pet) + pet_data = viewer_data[:custom_pet] self.pet_type = PetType.find_or_initialize_by_species_id_and_color_id( - pet_data.species_id.to_i, - pet_data.color_id.to_i - ) - self.pet_type.body_id = pet_data.body_id + pet_data[:species_id].to_i, + pet_data[:color_id].to_i + ) + self.pet_type.body_id = pet_data[:body_id] self.pet_type.origin_pet = self - biology = pet_data.biology_by_zone + biology = pet_data[:biology_by_zone] biology[0] = nil # remove effects if present @pet_state = self.pet_type.add_pet_state_from_biology! biology - @pet_state.label_by_pet(self, pet_data.owner) + @pet_state.label_by_pet(self, pet_data[:owner]) @items = Item.collection_from_pet_type_and_registries(self.pet_type, - viewer_data.object_info_registry, viewer_data.object_asset_registry, + viewer_data[:object_info_registry], viewer_data[:object_asset_registry], options[:item_scope]) end @@ -60,7 +60,7 @@ class Pet < ActiveRecord::Base rescue RocketAMF::RemoteGateway::ConnectionError => e raise DownloadError, e.message, e.backtrace end - OpenStruct.new(envelope.messages[0].data.body) + HashWithIndifferentAccess.new(envelope.messages[0].data.body) end def wardrobe_query @@ -106,7 +106,7 @@ class Pet < ActiveRecord::Base # Fetch registry data in parallel registries = Parallel.map(candidates.keys, :in_threads => 8) do |locale| viewer_data = I18n.with_locale(locale) { fetch_viewer_data } - [locale, viewer_data.object_info_registry] + [locale, viewer_data[:object_info_registry]] end # Look up any newly applied items on this pet, just in case