I'm a little baffled here and can't seem to find the proper resource or information online.
I'm creating a comment model in which any model can be commented on, here is what I did:
class Comment < ActiveRecord::Base
belongs_to :commentable, :polymorphic => true
belongs_to :user
end
So the comment additionally has the columns commentable_type
and commentable_id
,
class Thing < ActiveRecord::Base
has_many :comments, :as => :commentable
end
The form and everything render and work fine, and the record saves, except for the commentable_type
and commentable_id
columns, I don't understand what I'm missing here.