From baae0c9954545bc823239d1742452ddbdb733da1 Mon Sep 17 00:00:00 2001 From: Matchu Date: Tue, 21 Feb 2012 13:25:11 -0600 Subject: [PATCH] fix bug where some pet states would also show many items on top of them At first I thought this was an error in the data migration process when moving SWF assets to having their own unique IDs, but then realized that the query for a pet state's SWFs didn't include the (parent_type = 'Item') condition. Oops. Turns out, I only connected the items to parent_swf_asset_relationships polymorphically. Pet states were still doing it the hackish way. Set the pet states to use the lovely polymorphic relationship and we're good to go. --- app/models/pet_state.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/pet_state.rb b/app/models/pet_state.rb index 667a5c11..63cf8998 100644 --- a/app/models/pet_state.rb +++ b/app/models/pet_state.rb @@ -3,7 +3,7 @@ class PetState < ActiveRecord::Base has_many :contributions, :as => :contributed # in case of duplicates being merged has_many :outfits - has_many :parent_swf_asset_relationships, :foreign_key => 'parent_id', + has_many :parent_swf_asset_relationships, :as => :parent, :autosave => false has_many :swf_assets, :through => :parent_swf_asset_relationships