2013-04-07 71 views
2

我有一個應用程序使用http://agile2go.herokuapp.com/設計+慘慘。制定工作地方,但不工作在Heroku

運行的應用程序在本地工作正常,但在Heroku上部署時sign_up頁面顯示錯誤消息。但是,sign_in頁面正常工作!

我知道問題出在調用simple_form_for資源時,當我把資源從它的工作:

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

它適用於sign_in頁面!

這裏是我的routes.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 for #<User:0x00000004317050>

+3

你有沒有在Heroku上運行過所有的遷移? '$ heroku是否運行rake db:migrate:status --app app_name'報告任何未決的遷移? – catsby 2013-04-10 19:47:21

+0

已修復!我所做的遷移並沒有在我的模型user.rb上創建列名... TKS無論如何! – 2013-04-11 22:06:51

回答

1

我剛碰到同樣的問題 - raking爲我解決了這個問題。在你的控制檯試試這個:

$ heroku run rake db:migrate 
相關問題