Rails - 在Heroku上托管时干扰未定义的方法错误 - 在本地工作正常

时间:2015-11-24 08:20:39

标签: ruby-on-rails heroku heroku-postgres

我最近在我的应用中添加了full_name列。 一切都在本地工作正常,但是当我推送到Heroku时,每次刷新页面时都会出现间歇性的undefined method错误,但这只是我最近添加的full_name列。

2015-11-24T08:09:50.910236+00:00 app[web.1]:   Setting Load (1.6ms)  SELECT  "settings".* FROM "settings"  ORDER BY "settings"."id" ASC LIMIT 1
2015-11-24T08:09:50.906847+00:00 app[web.1]: Processing by UsersController#new as HTML
2015-11-24T08:09:50.913325+00:00 app[web.1]:   Rendered users/_form.html.haml (1.5ms)
2015-11-24T08:09:50.913413+00:00 app[web.1]:   Rendered users/new.html.haml within layouts/application (5.5ms)
2015-11-24T08:09:50.913542+00:00 app[web.1]: Completed 500 Internal Server Error in 7ms (ActiveRecord: 1.6ms)
2015-11-24T08:09:50.915353+00:00 app[web.1]:
2015-11-24T08:09:50.915355+00:00 app[web.1]: ActionView::Template::Error (undefined method `full_name' for #<User:0x007f253acdbe30>):
2015-11-24T08:09:50.915356+00:00 app[web.1]:     1: = simple_form_for @user, html: {novalidate: false, class: "form-inline"} do |f|
2015-11-24T08:09:50.915357+00:00 app[web.1]:     2:     = f.input :full_name, label: false, placeholder: "Full Name", input_html: {required: false }
2015-11-24T08:09:50.915358+00:00 app[web.1]:     3:     = f.input :email, as: :email, label: false, placeholder: "Email", input_html: {required: true }
2015-11-24T08:09:50.915358+00:00 app[web.1]:     4:     .form-group.submit
2015-11-24T08:09:50.915359+00:00 app[web.1]:     5:             = f.button :submit, "STEP INSIDE", class: "btn btn-branded"
2015-11-24T08:09:50.915360+00:00 app[web.1]:   app/views/users/_form.html.haml:2:in `block in _app_views_users__form_html_haml___3156326731190536782_69898937276340'
2015-11-24T08:09:50.915361+00:00 app[web.1]:   app/views/users/_form.html.haml:1:in `_app_views_users__form_html_haml___3156326731190536782_69898937276340'
2015-11-24T08:09:50.915361+00:00 app[web.1]:   app/views/users/new.html.haml:10:in `_app_views_users_new_html_haml__101258440498919246_69898938792180'
2015-11-24T08:09:50.915362+00:00 app[web.1]:   app/controllers/users_controller.rb:20:in `new'

难道我是Heroku的免费计划吗?

1 个答案:

答案 0 :(得分:0)

我的笨蛋忘记了exe:heroku restart - 现在工作正常。 也许我应该停止编码并进入睡眠状态,因为早上3点30分。