Guest User

Untitled

a guest
Feb 11th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. class Item < ActiveRecord::Base
  2. # assets
  3. has_many :assets, :as => :assetable, :dependent => :destroy
  4.  
  5. class Asset < ActiveRecord::Base
  6. belongs_to :assetable, :polymorphic => true
  7.  
  8. a=Asset.find(5)
  9. a.item # no dice
  10.  
  11. a=Asset.find(5)
  12. a.assetable
Add Comment
Please, Sign In to add comment