[英]heroku ActionView::Template::Error (undefined method `email'
我一直试图在heroku上部署应用程序,但遇到了很多问题。 我当前的问题是在注册时,我得到了一个未定义的方法,声称电子邮件不是Mate对象的已定义函数。 我跑了
heroku run rake db:migrate
和
heroku restart
这似乎无法解决问题。 另外,当我进入heroku终端并查看新的Mate对象时,它具有email属性。 这是我的heroku日志:
2013-07-14T22:38:29.637842+00:00 app[web.1]: Processing by HomeController#index as HTML
2013-07-14T22:38:29.650497+00:00 app[web.1]: Rendered home/index.html.erb within layouts/application (9.1ms)
2013-07-14T22:40:36.729670+00:00 app[web.1]: Started POST "/houses" for 71.202.122.134 at 2013-07-14 22:40:36 +0000
2013-07-14T22:40:36.803157+00:00 app[web.1]: Processing by Houses::RegistrationsController#create as HTML
2013-07-14T22:40:36.803157+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "authenticity_token"=>"Fsl63CocaqA04/vhoDC0sU/CCSd2YGasqudyCleDNbc=", "house"=>{"address"=>"90 Castro", "city"=>"San Francisco", "email"=>"zyskowski.rob@gmail.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Sign up"}
2013-07-14T22:40:37.085467+00:00 app[web.1]: Redirected to http://frozen-spire-1369.herokuapp.com/mates/sign_up
2013-07-14T22:40:37.085467+00:00 app[web.1]: Completed 302 Found in 282ms (ActiveRecord: 0.0ms)
2013-07-14T22:40:37.266161+00:00 app[web.1]: Processing by Mates::RegistrationsController#new as HTML
2013-07-14T22:40:37.276199+00:00 app[web.1]: Rendered mates/registrations/new.html.erb within layouts/application (8.2ms)
2013-07-14T22:40:37.088159+00:00 heroku[router]: at=info method=POST path=/houses host=frozen-spire-1369.herokuapp.com fwd="71.202.122.134" dyno=web.1 connect=1ms service=368ms status=302 bytes=118
2013-07-14T22:40:37.282256+00:00 heroku[router]: at=info method=GET path=/mates/sign_up host=frozen-spire-1369.herokuapp.com fwd="71.202.122.134" dyno=web.1 connect=1ms service=42ms status=500 bytes=643
2013-07-14T22:40:37.278470+00:00 app[web.1]: 24: <div class="controls">
2013-07-14T22:40:37.278470+00:00 app[web.1]: 27: </div>
2013-07-14T22:40:37.278470+00:00 app[web.1]: 28:
2013-07-14T22:40:37.278470+00:00 app[web.1]: ActionView::Template::Error (undefined method `email' for #<Mate:0x007f2d5d8efc88>):
2013-07-14T22:40:37.278470+00:00 app[web.1]: 23: <%= f.label :email, :class => "control-label" %>
2013-07-14T22:40:37.278470+00:00 app[web.1]:
2013-07-14T22:40:37.256850+00:00 app[web.1]: Started GET "/mates/sign_up" for 71.202.122.134 at 2013-07-14 22:40:37 +0000
2013-07-14T22:40:37.278470+00:00 app[web.1]: app/views/mates/registrations/new.html.erb:25:in `block in _app_views_mates_registrations_new_html_erb___482835816309687038_69916399610600'
2013-07-14T22:40:37.276313+00:00 app[web.1]: Completed 500 Internal Server Error in 10ms
2013-07-14T22:40:37.278470+00:00 app[web.1]: 22: <div class= "control-group">
2013-07-14T22:40:37.278470+00:00 app[web.1]: 25: <%= f.text_field :email, :placeholder => "email" , :autofocus => true %>
2013-07-14T22:40:37.278470+00:00 app[web.1]: 26: </div>
2013-07-14T22:40:37.278704+00:00 app[web.1]: app/views/mates/registrations/new.html.erb:9:in `_app_views_mates_registrations_new_html_erb___482835816309687038_69916399610600'
2013-07-14T22:40:37.278704+00:00 app[web.1]:
2013-07-14T22:40:37.278704+00:00 app[web.1]:
我很困在这里,所以任何想法都非常感谢! 谢谢!
我猜在您收到错误的任何视图中, email
都是空白的。在您的视图中编写如下内容:
<%= @user.email if @user.email? %>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.