heroku"未定义的方法"错误

时间:2012-04-29 20:27:47

标签: ruby-on-rails heroku

我的应用的用户模型包含“newbie”布尔属性。我在注册页面制作一个单选按钮,让新用户选择他是否是“新手”。

<%= f.radio_button :newbie, true %> <%= f.label :newbie, "I'm a newbie" %>   
<%= f.radio_button :newbie, false%> <%= f.label :newbie, "I'm not a newbie" %>

该应用在本地服务器上运行良好。但在部署到heroku之后,我无法访问注册页面。 heroku日志显示:

2012-04-29T20:16:16+00:00 app[web.1]: Started GET "/signup" for 72.181.169.183 at 2012-04-29 20:16:16 +0000
2012-04-29T20:16:16+00:00 app[web.1]: Processing by UsersController#new as HTML
2012-04-29T20:16:16+00:00 app[web.1]:   Rendered shared/_error_messages.html.erb (0.0ms)
2012-04-29T20:16:16+00:00 app[web.1]:   Rendered users/new.html.erb within layouts/application    (1.3ms)
2012-04-29T20:16:16+00:00 app[web.1]: Completed 500 Internal Server Error in 2ms
2012-04-29T20:16:16+00:00 app[web.1]: 
2012-04-29T20:16:16+00:00 app[web.1]: ActionView::Template::Error (undefined method `newbie' for #<User:0x00000004d21280>):
2012-04-29T20:16:16+00:00 app[web.1]:     6:     <%= form_for(@user) do |f| %>
2012-04-29T20:16:16+00:00 app[web.1]:     7:      <%= render 'shared/error_messages', object: f.object %>
2012-04-29T20:16:16+00:00 app[web.1]:     8:    
2012-04-29T20:16:16+00:00 app[web.1]:     10:     <%= f.radio_button :newbie, false%> <%= f.label :newbie, "I'm not a newbie" %>
2012-04-29T20:16:16+00:00 app[web.1]:     9:      <%= f.radio_button :newbie, true %> <%= f.label  :newbie, "I'm a newbie" %>
2012-04-29T20:16:16+00:00 app[web.1]:     11: 
2012-04-29T20:16:16+00:00 app[web.1]:   app/views/users/new.html.erb:9:in `block in _app_views_users_new_html_erb___587113142513507349_39337120'
2012-04-29T20:16:16+00:00 app[web.1]:     12:       <%= f.label :name %>
2012-04-29T20:16:16+00:00 app[web.1]:   app/views/users/new.html.erb:6:in     `_app_views_users_new_html_erb___587113142513507349_39337120'

我已经运行了迁移,我可以看到新手已成功迁移

Migrating to AddRoleToUsers (20120425182820) 
==  AddRoleToUsers: migrating =================================================
-- add_column(:users, :newbie, :boolean)
 -> 0.0023s
==  AddRoleToUsers: migrated (0.0024s) ========================================

可能是什么问题?

由于

0 个答案:

没有答案