简体   繁体   中英

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.

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.

As per the chat session with 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. Hence, its value was nil above. Suggested to define @getcompanymatchupto before using it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM