I would like to know why I am getting an error when I am building a record using FactoryGirl.
Comment model belongs to
commentable through polymorphic association.
My factory looks like this:
factory :comment do
text "Some text"
association :commentable, factory: :feedback
When I'm build a
comment record using FactoryGirl, I get:
can't write unknown attribute `commentable_type'
I have no problem creating and manipulating
Comment object in console. I can set and save
commentable_type attribute freely. Also,
commentable_type already exists in the
Any thoughts on why the error occurs?
I ran all my migrations again using
rake db:reset and now the error has disappeared. Before that, I have tried to rollback the related migration and migrate again, but that did not make any change.
I still do not know what caused this error, but for now, it is fixed.