简体   繁体   中英

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:

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.

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. 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.

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