【问题标题】:acts_as_commentable_with_threading uninitialized constant Post::Comment Rails 3.1.3act_as_commentable_with_threading 未初始化常量 Post::Comment Rails 3.1.3
【发布时间】:2012-03-29 13:06:29
【问题描述】:

我已将我的应用程序从 Rails 2.3.5 升级到 Rails 3.1.3。我有 acts_as_commentable_with_threadingawesome_nested_set 作为插件。现在我在 GemFile for Rails 3.1.3 中添加了如下

gem 'awesome_nested_set'
gem 'acts_as_commentable_with_threading'

我在模型中有如下代码

class Post < ActiveRecord::Base
  acts_as_commentable
end

acts_as_commentable_with_threading 的迁移已在数据库中应用。

我在视图中有声明为

<%= pluralize(post.root_comments.size, "comment") %> on this post

当我尝试加载该视图时,该行出现错误

uninitialized constant Post::Comment

可能是什么问题。请帮帮我。

提前致谢!

【问题讨论】:

  • 这个问题还没有解决办法吗?我刚开始收到此错误。
  • @jab 没有人。由于我放弃了该项目的工作,因此我没有进一步检查。

标签: ruby-on-rails-3 acts-as-commentable


【解决方案1】:

您可能忘记运行生成器和之后的迁移:

rails generate acts_as_commentable_with_threading_migration
or
rails generate acts_as_commentable_upgrade_migration

之后:

bin/rake db:migrate

这是github repo instructions的第一步

【讨论】:

    猜你喜欢
    • 2016-07-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-18
    • 2013-04-17
    • 2011-04-26
    • 1970-01-01
    相关资源
    最近更新 更多