[英]Rails Deployment to Heroku: NoMethodError: undefined method `+' for nil:NilClass
[英]Heroku + Rails: NoMethodError (undefined method `/' for nil:NilClass)
我的应用程序在本地运行良好,但是在推送到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重新启动。
根据与OP的聊天会话,
错误在以下行中:
@companysponsored = (finance.salary / 12) * (@getcompanysponsored.to_f / 100)* (@getcompanymatchupto.to_f / 100)
在此调用之后设置了@getcompanymatchupto
。 因此,其值高于零。 建议在使用@getcompanymatchupto
之前定义它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.