简体   繁体   English

Heroku + Rails:NoMethodError(nil:NilClass的未定义方法“ /”)

[英]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.

相关问题 Rails 部署到 Heroku: NoMethodError: undefined method `+' for nil:NilClass - Rails Deployment to Heroku: NoMethodError: undefined method `+' for nil:NilClass Rails4:NoMethodError /未定义的方法'*'为nil:NilClass - Rails4: NoMethodError / undefined method `*' for nil:NilClass Rails-NoMethodError-未定义的方法“名称”,为nil:NilClass - Rails - NoMethodError - undefined method `name' for nil:NilClass Rails 6-NoMethodError(nil:NilClass的未定义方法“ titleize”) - Rails 6 - NoMethodError (undefined method `titleize' for nil:NilClass) Rails 4:NoMethodError:nil的未定义方法`each':NilClass - Rails 4: NoMethodError: undefined method `each' for nil:NilClass Rails DateTime-NoMethodError(nil:NilClass的未定义方法“ []”) - Rails DateTime - NoMethodError (undefined method `[]' for nil:NilClass) Ruby On Rails - NoMethodError:nil:NilClass 的未定义方法“[]” - Ruby On Rails - NoMethodError: undefined method `[]' for nil:NilClass NoMethodError:nil的未定义方法'type':Rails中的NilClass - NoMethodError: Undefined method 'type' for nil:NilClass in Rails rails NoMethodError:nil:NilClass的未定义方法“” - rails NoMethodError: undefined method “ ” for nil:NilClass Rails - NoMethodError(nil:NilClass 的未定义方法 `collat​​ion') - Rails - NoMethodError (undefined method `collation' for nil:NilClass)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM