1

我正在使用 Mongodb 开发 ROR 应用程序。应用程序在本地主机上运行良好,但是当我在 heroku 中部署它时出现错误。我的查看文件命令之一是这样的:

@h=Portfolio.last.folders
<%= @h%>

Portfolio 是一个以字段文件夹为数组的集合。Mongodb 在生产中包含这个。即使我尝试在 heroku rails 控制台中做同样的事情,我也遇到了同样的错误:

TypeError: no implicit conversion of Fixnum into String
from /app/vendor/bundle/ruby/2.0.0/gems/moped-1.4.3/lib/moped/protocol/commands/authenticate.rb:35:in `+'
from /app/vendor/bundle/ruby/2.0.0/gems/moped-1.4.3/lib/moped/protocol/commands/authenticate.rb:35:in `digest'
from /app/vendor/bundle/ruby/2.0.0/gems/moped-1.4.3/lib/moped/protocol/commands/authenticate.rb:47:in `build_auth_command'
from /app/vendor/bundle/ruby/2.0.0/gems/moped-1.4.3/lib/moped/protocol/commands/authenticate.rb:25:in `initialize'
from /app/vendor/bundle/ruby/2.0.0/gems/moped-1.4.3/lib/moped/node.rb:488:in `new'
from /app/vendor/bundle/ruby/2.0.0/gems/moped-1.4.3/lib/moped/node.rb:488:in `login'
from /app/vendor/bundle/ruby/2.0.0/gems/moped-1.4.3/lib/moped/node.rb:48:in `block in apply_auth'
from /app/vendor/bundle/ruby/2.0.0/gems/moped-1.4.3/lib/moped/node.rb:47:in `each'
from /app/vendor/bundle/ruby/2.0.0/gems/moped-1.4.3/lib/moped/node.rb:47:in `apply_auth'
from /app/vendor/bundle/ruby/2.0.0/gems/moped-1.4.3/lib/moped/cluster.rb:250:in `with_secondary'
from /app/vendor/bundle/ruby/2.0.0/gems/moped-1.4.3/lib/moped/session/context.rb:104:in `with_node'
from /app/vendor/bundle/ruby/2.0.0/gems/moped-1.4.3/lib/moped/session/context.rb:43:in `query'
from /app/vendor/bundle/ruby/2.0.0/gems/moped-1.4.3/lib/moped/query.rb:115:in `first'
from /app/vendor/bundle/ruby/2.0.0/gems/mongoid-3.0.15/lib/mongoid/contextual/mongo.rb:233:in `last'
from /app/vendor/bundle/ruby/2.0.0/gems/mongoid-3.0.15/lib/mongoid/contextual.rb:18:in `last'
from /app/vendor/bundle/ruby/2.0.0/gems/mongoid-3.0.15/lib/mongoid/finders.rb:129:in `last'
from (irb):2
from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/commands/console.rb:47:in `start'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/commands/console.rb:8:in `start'
from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.12/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'

在开发机器中,我可以在控制台中执行此操作。任何人都猜到为什么在heroku上会出现这个错误。

4

0 回答 0