我已将我的一个应用程序的rails版本升级到4.1.0.升级时,我已经从Gemfile升级了所有的gems,它将act-as-taggable-on升级到了3.1.1.
但升级后,当我尝试在相应的对象上添加标签时,它会失败并出现以下错误.
post = Post.last post.tag_list = "development" post.save
ERROR: column “taggings_count” does not exist
细节错误在这里:
sql (0.9ms) UPDATE "tags" SET "taggings_count" = COALESCE("taggings_count",0) - 1 WHERE "tags"."id" = 3146 PG::UndefinedColumn: ERROR: column "taggings_count" does not exist LINE 1: UPDATE "tags" SET "taggings_count" = COALESCE("taggings_coun... ^ : UPDATE "tags" SET "taggings_count" = COALESCE("taggings_count",0) - 1 WHERE "tags"."id" = 3146 (0.3ms) ROLLBACK ActiveRecord::StatementInvalid: PG::UndefinedColumn: ERROR: column "taggings_count" does not exist LINE 1: UPDATE "tags" SET "taggings_count" = COALESCE("taggings_coun... ^ : UPDATE "tags" SET "taggings_count" = COALESCE("taggings_count",0) - 1 WHERE "tags"."id" = 3146
解决方法
只是我们要做,
rake acts_as_taggable_on_engine:install:migrations
由于actions-as-taggable-on已添加新的迁移.