ruby-on-rails-4 – 升级到rails 4.1后,as-taggable-on不起作用

前端之家收集整理的这篇文章主要介绍了ruby-on-rails-4 – 升级到rails 4.1后,as-taggable-on不起作用前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我已将我的一个应用程序的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已添加新的迁移.

原文链接:https://www.f2er.com/ruby/272024.html

猜你在找的Ruby相关文章