I have the following code in my view:
<%= link_to \'Sign out\', destroy_user_session_path, method: :delete %>
Which
Consider these two points to get rid of this error:
In your routes.rb
(if you don't want to use :delete
method):
devise_for :users do get '/users/sign_out' => 'devise/sessions#destroy' end
sign_out
link must have to contain :method => :delete
(already you have)
<%= link_to "Sign out", destroy_user_session_path, :method => :delete %>
And finally, in your layout
put:
<%= javascript_include_tag :defaults %>
Thanks.
link_to
fails back to a get if Javascript is not enabled. Looks like either your browser has Javascript disabled or more likely there is a Javascript error on the page. If there is an uncaught Javascript error on your page all other Javascript will fail to run after the error occurs.
Do you have
//= require jquery
//= require jquery_ujs
in your application.js file?
An alternative monkey patch would be to modify the devise.rb and change the signout method to get like so
config/initializers/devise.rb
config.sign_out_via = :get
This post may shed some light: Rails 3.2 with Devise: logout link stopped working