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
I had a similar problem, but addition of the :method=> :delete didn't work. I was able to add a new route for a the get request by commenting out the devise_for :users and adding
devise_for :users do
get '/users/sign_out' => 'devise/sessions#destroy'
end
= link_to "Sign out", destroy_user_session_path,:method => :delete
will NOT work instead use this,
= link_to "Sign out", destroy_user_session_path,:method => 'delete'
should do the trick or worse case add require jquery_ujs in your application.js
Maybe that will help somebody. Upgraded from Rails 3.0 to 3.1 and found this problem. This fixed it for me:
routes.rb:
devise_for: users
devise.rb:
config.sign_out_via = :delete
application.html.erb:
<%= javascript_include_tag "application" %>
* not :defaults
_login_items.html.erb:
<%= link_to('Logout', destroy_user_session_path, :method => :delete) %>
app/assets/javascripts/application.js
//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require_tree .
and I had in javascript/ jquery.js, jquery_ujs.js from 3.0 version that I've removed.
I just needed to add the
//= require jquery
//= require jquery_ujs
to my application.js
@creamhost say,
devise_for :users do get '/users/sign_out' => 'devise/sessions#destroy' end
but it is not correct solution for me (Rails4). I solved our problem (@Olives' answer),
link_to :logout, destroy_member_session_path, method: :delete
Had the same problem and remembered it only started happening after I decided to "clean up" my Javascript files. So I ran rails generate jquery:install --ui
again and this solved it for me. (You can ignore the --ui part if you don't need JQuery UI, I suppose.)