gpt4 book ai didi

ruby-on-rails - NoMethodError : undefined method `-' for nil:NilClass

转载 作者:IT老高 更新时间:2023-10-28 13:28:43 26 4
gpt4 key购买 nike

重新启动我的虚拟机后,每当我尝试访问任何数据时都会收到此错误。我正在使用 Rails 3.2.3 和带有 Mongoid 的 Mongodb。这是我第一个使用 MongoDB 和 Mongoid 的项目,我相当肯定这个问题与它有关。 Mongo 似乎已启动并正在运行。完整的错误信息是:

NoMethodError: undefined method `-' for nil:NilClass
from /home/development/.rvm/gems/ruby-1.9.3-p0@applicationName/gems/moped-1.2.5/lib/moped/cluster.rb:118:in `block in refresh'
from /home/development/.rvm/gems/ruby-1.9.3-p0@applicationName/gems/moped-1.2.5/lib/moped/cluster.rb:125:in `each'
from /home/development/.rvm/gems/ruby-1.9.3-p0@applicationName/gems/moped-1.2.5/lib/moped/cluster.rb:125:in `refresh'
from /home/development/.rvm/gems/ruby-1.9.3-p0@applicationName/gems/moped-1.2.5/lib/moped/cluster.rb:78:in `nodes'
from /home/development/.rvm/gems/ruby-1.9.3-p0@applicationName/gems/moped-1.2.5/lib/moped/cluster.rb:187:in `with_secondary'
from /home/development/.rvm/gems/ruby-1.9.3-p0@applicationName/gems/moped-1.2.5/lib/moped/session/context.rb:104:in `with_node'
from /home/development/.rvm/gems/ruby-1.9.3-p0@applicationName/gems/moped-1.2.5/lib/moped/session/context.rb:43:in `query'
from /home/development/.rvm/gems/ruby-1.9.3-p0@applicationName/gems/moped-1.2.5/lib/moped/query.rb:109:in `first'
from /home/development/.rvm/gems/ruby-1.9.3-p0@applicationName/gems/mongoid-3.0.6/lib/mongoid/contextual/mongo.rb:201:in `first'
from /home/development/.rvm/gems/ruby-1.9.3-p0@applicationName/gems/mongoid-3.0.6/lib/mongoid/contextual.rb:18:in `first'
from /home/development/.rvm/gems/ruby-1.9.3-p0@applicationName/gems/mongoid-3.0.6/lib/mongoid/finders.rb:119:in `first'
from (irb):3
from /home/development/.rvm/gems/ruby-1.9.3-p0@applicationName/gems/railties-3.2.8/lib/rails/commands/console.rb:47:in `start'
from /home/development/.rvm/gems/ruby-1.9.3-p0@applicationName/gems/railties-3.2.8/lib/rails/commands/console.rb:8:in `start'
from /home/development/.rvm/gems/ruby-1.9.3-p0@applicationName/gems/railties-3.2.8/lib/rails/commands.rb:41:in `<top (required)>'

最佳答案

听起来您的 mongoid.yml 已被覆盖。尝试执行 rails g mongoid:config 并重试。干杯。

关于ruby-on-rails - NoMethodError : undefined method `-' for nil:NilClass,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13685657/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com