automatically rezone bio
This commit is contained in:
parent
8ac12231f4
commit
cc23f7435b
2 changed files with 11 additions and 1 deletions
|
@ -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!
|
||||
|
|
|
@ -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|
|
||||
|
|
Loading…
Reference in a new issue