繁体   English   中英

Heroku上的未定义rails方法

[英]Undefined rails method on Heroku

我只是推送了一些更改heroku,现在我的应用程序坏了,即使它在dev中运行了find。 这就是“ heroku日志”所说的...

2013-11-07T18:58:47.712744+00:00 app[web.1]: ActionView::Template::Error (undefined method `user_type' for #<User:0x007f1f2ca092e8>):
2013-11-07T18:58:47.712897+00:00 app[web.1]:   app/views/users/_form.html.erb:1:in `_app_views_users__form_html_erb___784052068966039252_69885941331520'
2013-11-07T18:58:47.712744+00:00 app[web.1]: 
2013-11-07T18:58:47.712744+00:00 app[web.1]:     23:     <%= f.password_field :password_confirmation %>
2013-11-07T18:58:47.712744+00:00 app[web.1]:     24:   </div>
2013-11-07T18:58:47.712744+00:00 app[web.1]:     25:   <div class="field">
2013-11-07T18:58:47.712744+00:00 app[web.1]:     26:     <%= f.select :user_type, options_for_select(['Bar', 'Brewery', 'Restaurant', 'Hotel'], @user.user_type) %><br/>
2013-11-07T18:58:47.712744+00:00 app[web.1]:     27:   </div>
2013-11-07T18:58:47.712744+00:00 app[web.1]:   app/views/users/_form.html.erb:26:in `block in _app_views_users__form_html_erb___784052068966039252_69885941331520'
2013-11-07T18:58:47.712897+00:00 app[web.1]: 
2013-11-07T18:58:47.712744+00:00 app[web.1]:     28:   <div class="actions"><%= f.submit "Sign Up" %></div>
2013-11-07T18:58:47.712744+00:00 app[web.1]:     29: <% end %>
2013-11-07T18:58:47.712897+00:00 app[web.1]:   app/views/users/new.html.erb:2:in `_app_views_users_new_html_erb___2270355414211974343_69885950076300'

看起来不喜欢<%= f.select:user_type,options_for_select(['Bar','Brewery','Restaurant','Hotel'],@ user.user_type)%>
有任何想法吗?

运行应用程序的所有迁移,然后使用heroku restart启动应用程序。

最终成为我正在使用的Ruby版本。 我没有在我的Gemfile中指定ruby版本。 我在开发人员中使用1.9.3,但Heroku默认为2.0。 我加了线...

ruby '1.9.3'

到我的Gemfile的底部,我很喜欢上钩。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM