Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

about config.sign_out_via = :delete #1351

krzkrzkrz opened this Issue Sep 28, 2011 · 1 comment


None yet
2 participants

Ive got:

<%= link_to 'Sign out', destroy_user_session_path, :method => :delete %>

Routes says:

destroy_user_session DELETE /users/sign-out(.:format)     {:action=>"destroy", :controller=>"users/sessions"} 

But when I click this link, I get:

Routing error
No route matches [GET] "/users/sign-out"

So I did a bit of research and found out that Devise recently added something in their initializers/config file. Specifically config.sign_out_via = :delete.

So it should be working, but its not.

I read somewhere else that changing config.sign_out_via = :delete to config.sign_out_via = :get should work. I tried that and it did!

However, my link_to still looks like: <%= link_to 'Sign out', destroy_user_session_path, :method => :delete %>, which is inconsistent since my Devise initializer file has config.sign_out_via = :get.

Running on Rails 3.1, Devise 1.4.7.

Is this a bug?


josevalim commented Sep 28, 2011

If the routes output the proper thing (that it is using DELETE) and it is still doing a GET request, it is not a problem in Devise but a problem in Rails. Please check if your javascript is setup correctly and link_to :method => :delete is indeed sending a delete request instead of get.

@josevalim josevalim closed this Sep 28, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment