我有一个ruby-on-rails应用程序。 我使用Mongoid 4.0,现在更新到5.0。 当我在命令下运行时:
rails s
但收到错误:
config/application.rb:56:in `<class:Application>': uninitialized constant AppName::Application::Moped (NameError)
from config/application.rb:22:in `<module:ModeTokyo>'
from config/application.rb:21:in `<top (required)>'
from vendor/bundle/ruby/2.2.0/gems/spring-1.3.6/lib/spring/application.rb:82:in `require'
from vendor/bundle/ruby/2.2.0/gems/spring-1.3.6/lib/spring/application.rb:82:in `preload'
from vendor/bundle/ruby/2.2.0/gems/spring-1.3.6/lib/spring/application.rb:143:in `serve'
from vendor/bundle/ruby/2.2.0/gems/spring-1.3.6/lib/spring/application.rb:131:in `block in run'
from vendor/bundle/ruby/2.2.0/gems/spring-1.3.6/lib/spring/application.rb:125:in `loop'
from vendor/bundle/ruby/2.2.0/gems/spring-1.3.6/lib/spring/application.rb:125:in `run'
from vendor/bundle/ruby/2.2.0/gems/spring-1.3.6/lib/spring/application/boot.rb:18:in `<top (required)>'
from /Users/nora/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/nora/.rbenv/versions/2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'
我该如何解决此错误?
答案 0 :(得分:0)
这是因为config/application.rb
中的语句无效,自Mongoid 5以来无效。
我应该改变这一行:
Moped.logger.level = Logger::DEBUG
成:
Mongo::Logger.logger.level = Logger::DEBUG
这份文件会有所帮助:
http://docs.mongodb.org/ecosystem/tutorial/ruby-mongoid-tutorial/#logging