1

アプリケーションを 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

act_as_commentable_with_threadingの移行は、データベースに既に適用されています。

ビューに次のようなステートメントがあります

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

そのビューを読み込もうとすると、その行でエラーが発生します

uninitialized constant Post::Comment

何が問題になる可能性があります。私を助けてください。

前もって感謝します!

4

1 に答える 1

0

その後、ジェネレーターと移行を実行するのを忘れた可能性があります。

rails generate acts_as_commentable_with_threading_migration
or
rails generate acts_as_commentable_upgrade_migration

以降:

bin/rake db:migrate

github リポジトリの手順の最初のステップです

于 2015-10-27T11:11:50.470 に答える