5

在我的应用程序中,当我通过迁移添加此字段时,它是没有“名称”字段的用户模型。在我的本地主机上,我的注册表单工作正常,但在 heroku 上我有这个日志:

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'

我试过的:

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

但没有任何帮助。

4

2 回答 2

23

您还必须在迁移后重新启动 heroku - 您想运行

heroku run rake db:migrate
heroku restart
于 2012-07-20T13:14:42.997 回答
1

确保你已经完成git add .。然后git status确保所有文件都已提交。然后再次尝试推送。然后再次迁移。

于 2012-07-20T13:08:03.000 回答