heroku - 设计在本地工作但不在heroku上工作

标签 heroku devise ruby-on-rails-3.2

我有一个应用程序http://agile2go.herokuapp.com/使用 devise + cancan。

在本地运行应用程序工作正常,但部署在 Heroku 上时 sign_up页面显示错误消息。但是,登录页面工作正常!

我知道问题是在 simple_form_for 中调用资源时,当我取出资源时它起作用了:

<%= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => {:class => 'form-horizontal' }) do |f| %>

它适用于 sign_in页!

这是我的路线.rb

authenticated :user do 
  root :to => "home#index"
end
root :to => "home#index"     
devise_for :users, :path => "auth"

点击链接时在导航栏上:

<li><%= link_to 'Login', new_user_session_path %></li>//works
<li><%= link_to 'Sign up', new_user_registration_path %></li>//does not work  

最后是 Heroku 日志:

2013-04-07T21:55:15+00:00 app[web.1]: Started GET "/auth/sign_up" for 177.143.148.73 at    2013-04-07 21:55:15 +0000
2013-04-07T21:55:16+00:00 app[web.1]: 
2013-04-07T21:55:16+00:00 app[web.1]:     4: <%= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => {:class => 'form-horizontal' }) do |f| %>
2013-04-07T21:55:16+00:00 app[web.1]: ActionView::Template::Error (undefined method `name' for #<User:0x00000004317050>):
2013-04-07T21:55:16+00:00 app[web.1]:     5:   <%= f.error_notification %>
2013-04-07T21:55:16+00:00 app[web.1]:     9:   <%= f.input :password, :placeholder => 'Password', :required => true, input_html: { class: 'text_field input-xlarge' } %>
2013-04-07T21:55:16+00:00 app[web.1]:     10:   <%= f.input :password_confirmation, :placeholder => 'Confirmation', :required => true, input_html: { class: 'text_field input-xlarge' } %>
2013-04-07T21:55:16+00:00 app[web.1]:     8:   <%= f.input :email, :placeholder => 'Email', :required => true, input_html: { class: 'text_field input-xlarge' } %>
2013-04-07T21:55:16+00:00 app[web.1]:     7:   <%= f.input :name, :placeholder => 'Name', :autofocus => true, input_html: { class: 'text_field input-xlarge' } %>
2013-04-07T21:55:16+00:00 app[web.1]:   app/views/devise/registrations/new.html.erb:7:in `block in _app_views_devise_registrations_new_html_erb__4395295283282032383_35150600'
2013-04-07T21:55:16+00:00 app[web.1]:   app/views/devise/registrations/new.html.erb:4:in `_app_views_devise_registrations_new_html_erb__4395295283282032383_35150600'
2013-04-07T21:55:16+00:00 app[web.1]: 
2013-04-07T21:55:16+00:00 app[web.1]:     6:   <%= display_base_errors resource %>  
2013-04-07T21:55:16+00:00 app[web.1]: 
2013-04-07T21:55:16+00:00 heroku[router]: at=info method=GET path=/auth/sign_up host=agile2go.herokuapp.com fwd="177.143.148.73" dyno=web.1 connect=2ms service=228ms status=500 bytes=643

我不知道为什么它说未定义的方法 name对于 #<User:0x00000004317050>

最佳答案

我刚刚遇到了同样的问题 - raking 为我解决了这个问题。在控制台中尝试一下:

$ heroku run rake db:migrate

关于heroku - 设计在本地工作但不在heroku上工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15868544/

相关文章:

html - 错误禁止保存此用户 :

ruby-on-rails-3.2 - 依赖 : :destroy leading to postgresql error

ruby-on-rails - 纯 HTML 和 Rails/ERB 帮助程序模板之间的性能差异

postgresql - Heroku 上的语法错误,但本地服务器上没有(与 postgresql 相关?)

ruby-on-rails - 从 Backbone 检索 rails/devise current_user

python - 将 Flask 应用程序部署到 Heroku

ruby-on-rails - RailsAdmin for Rails3(带设计)-仅用于管理 View ?

ruby-on-rails - 为引擎生成模型和迁移

docker - Heroku 上的 .Net Core 和 Docker

mysql - 如何通过mysql工作台将我的Mysql数据库推送到heroku?