Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Item < ActiveRecord::Base
- # assets
- has_many :assets, :as => :assetable, :dependent => :destroy
- class Asset < ActiveRecord::Base
- belongs_to :assetable, :polymorphic => true
- a=Asset.find(5)
- a.item # no dice
- a=Asset.find(5)
- a.assetable
Add Comment
Please, Sign In to add comment