【问题标题】:Rails - Intermitten undefined method error while hosting on Heroku - works fine locallyRails - 在 Heroku 上托管时出现间歇性未定义方法错误 - 在本地工作正常
【发布时间】:2015-11-24 08:20:39
【问题描述】:

我最近在我的应用中添加了 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 的免费计划?

【问题讨论】:

  • 请确保您的 User 对象没有 nil 值。这与免费计划无关,这是肯定的。

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


【解决方案1】:

我的笨蛋忘了 exe:heroku restart - 现在可以正常工作了。 也许我应该停止编码并去睡觉,因为现在是凌晨 3:30。

【讨论】:

    猜你喜欢
    • 2017-01-25
    • 1970-01-01
    • 2017-02-24
    • 2018-12-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-23
    相关资源
    最近更新 更多