Imported from Lighthouse. Original ticket at: http://rails.lighthouseapp.com/projects/8994/tickets/6761
Created by Gabriel Mazetto - 2011-05-02 04:49:47 UTC
Use this two models:
class Item < ActiveRecord::Base
belongs_to :itemable, :polymorphic => true
class Product < ActiveRecord::Base
has_one :item, :as => :itemable, :dependent => destroy
now try to:
@product = Product.new(params[:product])
And you will get a error lacking the "item.itemable_id"
So, build_item is defining the correct itemable_type, but are not dealing with the id... I expect it to save "course" first, get it's id and them set it on itemable_id and then save "item".
Imported from Lighthouse.
Comment by Gabriel Mazetto - 2011-05-02 04:52:57 UTC
Also forget to mention that it's rails 3.0.7