No route matches [GET] “/users/sign_out”

前端 未结 19 1657
谎友^
谎友^ 2020-12-04 18:44

Here is my actual error: No route matches [GET] \"/members/sign_out\" Since most people will use \"users\" I thought it would be more helpful to have that in th

19条回答
  •  天命终不由人
    2020-12-04 19:12

    Although I don't know the cause, the reason why you are getting that message is because in your routes you have

    destroy_member_session DELETE /members/sign_out(.:format)      {:action=>"destroy", :controller=>"devise/sessions"}
    

    Which means that route is only available with the DELETE method as opposed to GET. This is a bit weird since in the docs for devise it says that it should create it as GET route (https://github.com/plataformatec/devise/blob/master/lib/devise/rails/routes.rb#L30)

    With it as a DELETE route, you should be able to logout using

    link_to :logout, destroy_member_session_path, :method => :delete 
    

提交回复
热议问题