[英]Heroku + Rails: NoMethodError (undefined method `/' for nil:NilClass)
My app is running perfectly locally, but I'm unable to bring it up after pushing to Heroku. 我的应用程序在本地运行良好,但是在推送到Heroku后无法启动。
Here are the logs: 以下是日志:
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'
I did a heroku rake db:migrate and even a heroku restart. 我做了一个heroku rake db:migrate甚至一个heroku重新启动。
As per the chat session with OP, 根据与OP的聊天会话,
The error was on below line: 错误在以下行中:
@companysponsored = (finance.salary / 12) * (@getcompanysponsored.to_f / 100)* (@getcompanymatchupto.to_f / 100)
@getcompanymatchupto
was set AFTER this call. 在此调用之后设置了@getcompanymatchupto
。 Hence, its value was nil above. 因此,其值高于零。 Suggested to define @getcompanymatchupto
before using it. 建议在使用@getcompanymatchupto
之前定义它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.