简体   繁体   English

ActionView :: Template :: Error(nil:NilClass的未定义方法“代码”)

[英]ActionView::Template::Error (undefined method 'code' for nil:NilClass)

My app runs perfectly on my local server but returns the error below when I try to push it to heroku: 我的应用程序可以在本地服务器上完美运行,但是当我尝试将其推送到heroku时返回以下错误:

ActionView::Template::Error (undefined method 'code' for nil:NilClass)

The method 'code' is the title of the first column in my SQLite database and is used to search for products in a search bar which are then graphed on my app. 方法'code'是我的SQLite数据库中第一列的标题,用于在搜索栏中搜索产品,然后将其绘制在我的应用程序上。

Anyone know what could be causing this? 有人知道是什么原因造成的吗?

It's really hard to tell without seeing any code, but more than likely, somewhere you're doing 很难不看任何代码就很难分辨,但是很有可能在您正在执行的某处

some_variable.code

and this variable is nil. 这个变量为nil What's probably happening is that you haven't added data into your production database (on Heroku) that you have in your development (local) database, which is causing this variable to be nil on Heroku. 可能正在发生的事情是,您尚未将开发(本地)数据库中的数据添加到生产数据库(在Heroku中),这导致该变量在Heroku上为nil

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ActionView :: Template :: Error:未定义的方法&#39;&lt;&#39;为nil:NilClass - ActionView::Template::Error: undefined method `<' for nil:NilClass ActionView :: Template :: Error:ActionView :: Template :: Error:未定义的方法`[]&#39;为nil:NilClass - ActionView::Template::Error: ActionView::Template::Error: undefined method `[]' for nil:NilClass 错误ActionView :: Template :: Error(nil:NilClass的未定义方法“名称”) - Error ActionView::Template::Error (undefined method `name' for nil:NilClass) ActionView :: Template :: Error(nil:NilClass的未定义方法“ strip!”) - ActionView::Template::Error (undefined method `strip!' for nil:NilClass) Heroku ActionView :: Template :: Error(nil:NilClass的未定义方法“名称”) - Heroku ActionView::Template::Error (undefined method `name' for nil:NilClass) FactoryGirl Rspec ActionView :: Template :: Error:nil:NilClass的未定义方法 - FactoryGirl Rspec ActionView::Template::Error: undefined method for nil:NilClass ActionView :: Template :: Error(nil:NilClass的未定义方法“ event_title”) - ActionView::Template::Error (undefined method `event_title' for nil:NilClass) ActionView :: Template :: Error(nil:NilClass的未定义方法“ force_encoding”): - ActionView::Template::Error (undefined method `force_encoding' for nil:NilClass): ActionView :: Template :: Error(nil:NilClass的未定义方法“标题”) - ActionView::Template::Error (undefined method `title' for nil:NilClass) ActionView :: Template :: Error:nil:NilClass的未定义方法&#39;email&#39; - ActionView::Template::Error: undefined method `email' for nil:NilClass
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM