Mongodb,mongoid Rails 3.1。* Active记录错误

时间:2012-02-25 13:07:41

标签: activerecord mongodb ruby-on-rails-3.1 mongoid

3-4个月后,当我回到RoR的另一个项目时,使用Mongoid。我被困在这个奇怪的问题上。正如我一直关注Mongoid记录的那样。 生成mongoid.yml,删除database.yml。并改变了

#require 'rails/all'
require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "rails/test_unit/railtie"
require "sprockets/railtie" # Uncomment this line for Rails 3.1+
config/application.rb中的

我仍然面临着这个问题。用,启动服务器。

configuration.rb:85:in `method_missing': undefined method `active_record' for #<Rails::Application::Configuration:0x9441fd4> (NoMethodError)

哎呀我不得不评论出来 config.active_record.mass_assignment_sanitizer = :strict
config.active_record.auto_explain_threshold_in_seconds = 0.5config/environments/development.rb

1 个答案:

答案 0 :(得分:9)

评论以下几行

config.active_record.mass_assignment_sanitizer = :strict
config.active_record.auto_explain_threshold_in_seconds = 0.5

在config / environments / development.rb和config / environments / test.rb