When I did rails db: migrate
, I got the following error.
When I read the error statement, I was angry that "The VersionAsociation
table does not have a foreign_type
column!".
ActiveModel::UnknownAttributeError: unknown attribute 'foreign_type' for PaperTrail::VersionAssociation
Occurs by updating a gem called paper_trail.
Looking at CHANGELOG.md in the official repository, I found a description about foreign_type
. ..
How to Upgrade from v1.0.0 or earlier Run rails g paper_trail_association_tracking:add_foreign_type_to_version_associations and then migrate your database.
Create a migration file to add columns and then rails db: migrate
.
terminal
#Create a migration file to add columns
rails g paper_trail_association_tracking:add_foreign_type_to_version_associations
#Apply the created migration file
rails db:migrate