Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Product < ActiveRecord::Base
- belongs_to :buyable, :polymorphic => true
- end
- class Wine < ActiveRecord::Base
- has_one :product, :as => :buyable
- end
- # this works
- @wine = Wine.find(:first)
- @wine.product.attribute_x -> "the value as expected"
- # how do i get this one to work?
- @product = Product.find(:first)
- @product.wine.attribute_x -> undefined method wine
Add Comment
Please, Sign In to add comment