impress/app/models/parent_swf_asset_relationship.rb

27 lines
660 B
Ruby
Raw Normal View History

class ParentSwfAssetRelationship < ActiveRecord::Base
set_table_name 'parents_swf_assets'
2010-10-10 19:18:42 -07:00
belongs_to :biology_asset, :class_name => 'SwfAsset', :foreign_key => 'swf_asset_id', :conditions => {:type => 'biology'}
belongs_to :object_asset, :class_name => 'SwfAsset', :foreign_key => 'swf_asset_id', :conditions => {:type => 'object'}
def swf_asset
self.swf_asset_type == 'biology' ? self.biology_asset : self.object_asset
end
def item
parent
end
def item=(replacement)
2010-05-16 17:45:30 -07:00
self.parent_id = replacement.id
end
def pet_state
2010-05-16 17:45:30 -07:00
parent
end
def pet_state=(replacement)
2010-05-16 17:45:30 -07:00
self.parent_id = replacement.id
end
end