升级到rails 4.1后,act-as-taggable-on无效

时间:2014-04-23 09:03:13

标签: ruby-on-rails-4 acts-as-taggable-on ruby-on-rails-4.1

我已将我的应用程序的rails版本升级到4.1.0。在升级时,我已经从Gemfile升级了所有宝石,Gemfile也将act-as-taggable-on升级到3.1.1。

但升级后,当我尝试在相应对象上添加标记时,它会失败,并显示以下错误。

  post = Post.last
  post.tag_list = "development"
  post.save
  

错误:列" taggings_count"不存在

详细信息错误在这里:

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

1 个答案:

答案 0 :(得分:27)

我们必须这样做,

  

rake acts_as_taggable_on_engine:install:migrations

由于act-as-taggable-on已添加了新的迁移。