Rails 3.0.9 + Devise + Cucumber + Capybara the infamous “No route matches /users/sign_out”

后端 未结 6 1740
我寻月下人不归
我寻月下人不归 2021-02-02 09:27

I am using devise 1.4.2 with rails 3.0.9, cucumber-rails 1.0.2, capybara 1.0.0. I got No route matches \"/users/sign_out\" error when I clicked logout. I added

6条回答
  •  不思量自难忘°
    2021-02-02 10:30

    I'm actually having the same exact problem but with a Rails/Sinatra app. I've got Devise set up for Rails and the logout works. I've got a GuestApp Sinatra app running in lib, which works great except for the logout link. I'm trying to force data-method="delete" on the sinatra logout link, but nothing i do will make the request a delete request.

    I think this might me a sinatra problem for me, but I thought what ever requests come in are processed by rails routes first until they reach my sinatra route. I'm about to manually add the GET route for logout, but I'd rather not have to do that.

    Here's my devise routes:

    devise_for :member, :path => '', :path_names => {
      :sign_in => "login",
      :sign_out => "logout",
      :sign_up => "register" }
    

    Here's my link:

    %a{:href => '/logout', :"data-method" => 'delete', :rel => 'nofollow'}Log Out
    Log Out
    
    #- realized it should be method instead, but still not reaching routes.rb as delete
    Log Out
    

提交回复
热议问题