Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

heroku undefined method `name' for User

In my app it was User model without 'name' field, when I added this field by migration. On my localhost my sign up form works fine, but on heroku I have this log:

ActionView::Template::Error (undefined method `name' for #<User:0x0000000518fb00>):
Rendered users/new.html.haml within layouts/application (3.1ms)
     5:       = f.input :name, required: 'true'
     6:       = f.input :email, required: 'true'
     3:     %h1 Sign up
     4:     = simple_form_for @user do |f|
     7:       = f.input :password
     8:       = f.input :password_confirmation, required: 'true'

What I've tried:

heroku run rake db:migrate
heroku run rake db:reset

but nothing helped.

like image 331
cnaize Avatar asked Jul 20 '12 12:07

cnaize


2 Answers

you also have to restart heroku after migrating - you'd want to run

heroku run rake db:migrate
heroku restart
like image 129
danpickett Avatar answered Oct 24 '22 01:10

danpickett


Make sure you have done git add .. Then git status to make sure that all the files have been committed. Then try the push again. Then migrate again.

like image 21
Benjamin Tan Wei Hao Avatar answered Oct 24 '22 00:10

Benjamin Tan Wei Hao