我在我的 Rails 2 应用程序中使用acts_as_audited 并且正在将其更新到 Rails 3。我已经更新了几个模型来调用audited
而不是acts_as_audited
并且这些模型似乎工作成功。但是,我现在正在更新我的应用程序的用户模型,当我尝试创建用户(从控制台或应用程序)时,我收到以下错误:
uninitialized constant User::Audit
看起来相关的地方的追踪是:
activerecord (3.2.8) lib/active_record/inheritance.rb:111:in `compute_type'
activerecord (3.2.8) lib/active_record/reflection.rb:172:in `klass'
activerecord (3.2.8) lib/active_record/associations/collection_association.rb:148:in `transaction'
activerecord (3.2.8) lib/active_record/associations/collection_association.rb:431:in `create_record'
activerecord (3.2.8) lib/active_record/associations/collection_association.rb:119:in `create'
activerecord (3.2.8) lib/active_record/associations/collection_proxy.rb:46:in `create'
audited (3.0.0) lib/audited/auditor.rb:216:in `block in write_audit'
activesupport (3.2.8) lib/active_support/callbacks.rb:403:in `_run__3460157709255055264__audit__3867610640799995319__callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.8) lib/active_support/callbacks.rb:385:in `_run_audit_callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:81:in `run_callbacks'
audited (3.0.0) lib/audited/auditor.rb:216:in `write_audit'
audited (3.0.0) lib/audited/auditor.rb:198:in `audit_create'
在我的控制器中创建问题的行只是说明:
if @editing_user.save
我查看了已审核的 github 帐户的支持列表,但找不到任何适合我的问题的内容。我想我会在这里问一下是否有人遇到过类似的问题。我也在这里和谷歌搜索过这个特定问题的答案,但找不到任何相关的东西。
有任何想法吗?