1
0
Fork 0
forked from OpenNeo/impress

another attempt to fix pet state rel autosave

This commit is contained in:
Emi Matchu 2012-01-13 16:11:44 -06:00
parent bcb5644b12
commit 4566bca906

View file

@ -11,6 +11,8 @@ class PetState < ActiveRecord::Base
alias_method :swf_asset_ids_from_association, :swf_asset_ids alias_method :swf_asset_ids_from_association, :swf_asset_ids
attr_writer :parent_swf_asset_relationships_to_update
bio_effect_zone_id = 4 bio_effect_zone_id = 4
scope :emotion_order, joins(:parent_swf_asset_relationships). scope :emotion_order, joins(:parent_swf_asset_relationships).
joins("LEFT JOIN swf_assets effect_assets ON effect_assets.remote_id = parents_swf_assets.swf_asset_id AND effect_assets.zone_id = #{bio_effect_zone_id}"). joins("LEFT JOIN swf_assets effect_assets ON effect_assets.remote_id = parents_swf_assets.swf_asset_id AND effect_assets.zone_id = #{bio_effect_zone_id}").
@ -54,7 +56,7 @@ class PetState < ActiveRecord::Base
end end
def handle_assets! def handle_assets!
parent_swf_asset_relationships.each do |rel| @parent_swf_asset_relationships_to_update.each do |rel|
rel.swf_asset.save! rel.swf_asset.save!
rel.save! rel.save!
end end
@ -109,7 +111,7 @@ class PetState < ActiveRecord::Base
relationships << relationship relationships << relationship
end end
end end
pet_state.parent_swf_asset_relationships = relationships pet_state.parent_swf_asset_relationships_to_update = relationships
pet_state pet_state
end end