2010-05-16 12:01:38 -07:00
|
|
|
class ParentSwfAssetRelationship < ActiveRecord::Base
|
|
|
|
set_table_name 'parents_swf_assets'
|
|
|
|
|
2012-01-12 15:17:59 -08:00
|
|
|
belongs_to :parent, :polymorphic => true
|
2011-01-27 13:35:46 -08:00
|
|
|
|
2012-01-12 15:17:59 -08:00
|
|
|
belongs_to :swf_asset
|
2010-05-16 12:01:38 -07:00
|
|
|
|
|
|
|
def item=(replacement)
|
2012-01-12 15:17:59 -08:00
|
|
|
self.parent = replacement
|
2010-05-16 17:45:30 -07:00
|
|
|
end
|
|
|
|
|
2010-05-20 18:11:08 -07:00
|
|
|
def pet_state
|
2011-01-27 13:35:46 -08:00
|
|
|
PetState.find(parent_id)
|
2010-05-16 17:45:30 -07:00
|
|
|
end
|
|
|
|
|
2010-05-20 18:11:08 -07:00
|
|
|
def pet_state=(replacement)
|
2012-01-12 15:17:59 -08:00
|
|
|
self.parent = replacement
|
2010-05-16 12:01:38 -07:00
|
|
|
end
|
|
|
|
end
|