1
0
Fork 0
forked from OpenNeo/impress

automatically rezone bio

This commit is contained in:
Emi Matchu 2011-10-31 16:22:24 -05:00
parent 8ac12231f4
commit cc23f7435b
2 changed files with 11 additions and 1 deletions

View file

@ -65,7 +65,11 @@ class Pet < ActiveRecord::Base
before_validation do
pet_type.save!
@pet_state.save! if @pet_state
if @pet_state
@pet_state.handle_assets!
@pet_state.save!
end
if @items
@items.each do |item|
item.handle_assets!

View file

@ -54,6 +54,12 @@ class PetState < ActiveRecord::Base
self['swf_asset_ids'] = ids
end
def handle_assets!
parent_swf_asset_relationships.each do |rel|
rel.swf_asset.save!
end
end
def self.from_pet_type_and_biology_info(pet_type, info)
swf_asset_ids = []
info.each do |zone_id, asset_info|