ActionController :: RoutingError(没有路由匹配[GET]" / users / sign_out"):rails 4

时间:2015-06-16 02:25:41

标签: ruby-on-rails ruby-on-rails-4 routes

我无法修复此错误。当我在heroku上进行生产时单击我的注销按钮时出现错误。但是,它在开发中有效。这是我的代码

<% if user_signed_in? %>
<li><%= link_to "Log out",  destroy_user_session_path, method: :delete %></li>
 <% else %>
 <li><%= link_to "Sign in", new_user_session_path %></li>
 <% end%>

路线:

        new_user_session GET    /users/sign_in(.:format)       devise/sessions#new                                                                                                                                             
            user_session POST   /users/sign_in(.:format)       devise/sessions#create                                                                                                                                          
    destroy_user_session DELETE /users/sign_out(.:format)      devise/sessions#destroy                                                                                                                                         
           user_password POST   /users/password(.:format)      devise/passwords#create                                                                                                                                         
       new_user_password GET    /users/password/new(.:format)  devise/passwords#new                                                                                                                                            
      edit_user_password GET    /users/password/edit(.:format) devise/passwords#edit                                                                                                                                           
                         PATCH  /users/password(.:format)      devise/passwords#update                                                                                                                                         
                         PUT    /users/password(.:format)      devise/passwords#update                                                                                                                                         
cancel_user_registration GET    /users/cancel(.:format)        devise/registrations#cancel                                                                                                                                     
       user_registration POST   /users(.:format)               devise/registrations#create                                                                                                                                     
   new_user_registration GET    /users/sign_up(.:format)       devise/registrations#new                                                                                                                                        
  edit_user_registration GET    /users/edit(.:format)          devise/registrations#edit                                                                                                                                       
                         PATCH  /users(.:format)               devise/registrations#update                                                                                                                                     
                         PUT    /users(.:format)               devise/registrations#update                                                                                                                                     
                         DELETE /users(.:format)               devise/registrations#destroy   

1 个答案:

答案 0 :(得分:0)

我认为这是资产预编译问题。当您在本地工作时,您运行了资产预编译。当您部署到Heroku时,您现在在公共/资产目录中有较旧的文件,但是由于对站点进行了进一步更改并重新部署到Heroku,因此您没有运行资产预编译。

您可以在本地再次运行资产预编译:

RAILS_ENV=production bundle exec rake assets:precompile

或者删除public / assets目录,提交并重新部署以便Heroku。

请阅读此处以获取更多参考资料以及可能的进一步问题排查帮助:https://devcenter.heroku.com/articles/rails-4-asset-pipeline