forked from OpenNeo/impress
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
|
before_validation do
|
||||||
pet_type.save!
|
pet_type.save!
|
||||||
@pet_state.save! if @pet_state
|
if @pet_state
|
||||||
|
@pet_state.handle_assets!
|
||||||
|
@pet_state.save!
|
||||||
|
end
|
||||||
|
|
||||||
if @items
|
if @items
|
||||||
@items.each do |item|
|
@items.each do |item|
|
||||||
item.handle_assets!
|
item.handle_assets!
|
||||||
|
|
|
@ -53,6 +53,12 @@ class PetState < ActiveRecord::Base
|
||||||
def swf_asset_ids=(ids)
|
def swf_asset_ids=(ids)
|
||||||
self['swf_asset_ids'] = ids
|
self['swf_asset_ids'] = ids
|
||||||
end
|
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)
|
def self.from_pet_type_and_biology_info(pet_type, info)
|
||||||
swf_asset_ids = []
|
swf_asset_ids = []
|
||||||
|
|
Loading…
Reference in a new issue