简体   繁体   English

Heroku上的未定义rails方法

[英]Undefined rails method on Heroku

I just pushed some changes heroku and now my app is broke, even though it runs find in dev. 我只是推送了一些更改heroku,现在我的应用程序坏了,即使它在dev中运行了find。 Here is what 'heroku logs' is saying... 这就是“ 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'

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

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

Ended up being the version of Ruby that I was using. 最终成为我正在使用的Ruby版本。 I did not specify the ruby version in my Gemfile. 我没有在我的Gemfile中指定ruby版本。 I am using 1.9.3 in dev, but Heroku defaults to 2.0. 我在开发人员中使用1.9.3,但Heroku默认为2.0。 I added the line... 我加了线...

ruby '1.9.3'

to the bottom of my Gemfile and I was good to hook. 到我的Gemfile的底部,我很喜欢上钩。

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

相关问题 Rails / Heroku未定义方法错误 - Rails/Heroku undefined method error Heroku + Rails:NoMethodError(nil:NilClass的未定义方法“ /”) - Heroku + Rails: NoMethodError (undefined method `/' for nil:NilClass) 如何修复 Rails + Heroku 中未定义的方法错误 - How to fixed undefined method error in Rails + Heroku Rails heroku ActionView::Template::Error(未定义的方法`author&#39; - Rails heroku ActionView::Template::Error (undefined method `author' 迁移期间未定义的方法&#39;bool&#39;(Rails Heroku Postgres) - Undefined method 'bool' during migration (Rails Heroku Postgres) Rails app heroku推送未定义的方法`active_record&#39;for - Rails app heroku push undefined method `active_record' for 在Heroku上部署的Rails未定义方法`[]&#39;,用于处理参数的nil:NilClass - Rails Deployed on Heroku undefined method `[]' for nil:NilClass dealing with params 在Heroku中引导Rails服务器时未定义的方法add_column - Undefined method add_column when booting rails server in Heroku Heroku ruby​​-on-rails部署“ nil:NilClass的未定义方法&#39;info&#39;” - Heroku ruby-on-rails deployment “undefined method `info' for nil:NilClass” Rails 部署到 Heroku: NoMethodError: undefined method `+' for nil:NilClass - Rails Deployment to Heroku: NoMethodError: undefined method `+' for nil:NilClass
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM