Heroku + Rails:NoMethodError(未定义的方法`/'对于nil:NilClass)

时间:2014-04-27 22:00:52

标签: ruby-on-rails ruby heroku ruby-on-rails-4

我的应用程序在本地运行完美,但在推送到Heroku之后我无法启动它。

以下是日志:

2014-04-27T21:56:42.590706+00:00 app[web.1]: Started GET "/" for 98.217.72.49 at 2014-04-27 21:56:42 +0000
2014-04-27T21:56:42.593370+00:00 app[web.1]: Processing by FinancesController#index as HTML
2014-04-27T21:56:42.593370+00:00 app[web.1]: Processing by FinancesController#index as HTML
2014-04-27T21:56:42.621915+00:00 app[web.1]: Completed 500 Internal Server Error in 28ms
2014-04-27T21:56:42.621915+00:00 app[web.1]: Completed 500 Internal Server Error in 28ms
2014-04-27T21:56:42.623629+00:00 app[web.1]: 
2014-04-27T21:56:42.623629+00:00 app[web.1]: NoMethodError (undefined method `/' for nil:NilClass):
2014-04-27T21:56:42.623629+00:00 app[web.1]:   app/controllers/finances_controller.rb:103:in `retirementalgorithm'

我做了一个heroku rake db:migrate甚至heroku重启。

1 个答案:

答案 0 :(得分:0)

根据与OP的聊天会话,

错误发生在以下行:

 @companysponsored = (finance.salary / 12) * (@getcompanysponsored.to_f / 100)* (@getcompanymatchupto.to_f / 100)
此次通话后已设置

@getcompanymatchupto。因此,它的价值高于零。建议在使用之前定义@getcompanymatchupto