2013-07-14 117 views
0

我一直在尝试在heroku上部署应用程序,并且遇到了很多问题。我目前的问题是在注册时,我得到未定义的方法声称的电子邮件是不是一个定义函数的择偶对象。我已经运行heroku ActionView :: Template :: Error(未定义的方法`电子邮件'

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"=>"[email protected]", "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]: 

我很喜欢这里,所以任何想法都非常感谢!谢谢!

+0

什么是'Mate'? 'email'字段是如何添加到'mates'表中的?是否有这样的迁移?该迁移是否承诺进行版本控制?你把最新的提交推向Heroku吗? –

回答

0

我猜email是空白,无论大家认为你得到的错误写这样的事情在您的视图:

<%= @user.email if @user.email? %> 
相关问题