【问题标题】:After upgrading to rails 4.1, acts-as-taggable-on is not working升级到 rails 4.1 后,acts-as-taggable-on 不起作用
【发布时间】:2014-04-23 09:03:13
【问题描述】:

我已将我的一个应用程序的 rails 版本升级到 4.1.0。在升级时,我已经升级了 Gemfile 中的所有 gem,它也将 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

【问题讨论】:

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


    【解决方案1】:

    只是我们必须做的,

    rakeacts_as_taggable_on_engine:install:migrations

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

    【讨论】:

    • 我在重复条目时遇到问题...对于键“index_tags_on_name”:创建唯一索引 index_tags_on_name ON tags (name)。不知道这里有没有要了解的地方
    • 在生成的第一个迁移中,删除创建 index_tags_on_name 的第一行(我会复制/粘贴,但我已经删除了它)。
    猜你喜欢
    • 2011-04-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多