Problem closing session using the devise gem ("No route matches [GET]" / users / sign_out ")

1

I am creating a social network project and for this I am using the devise gem, everything is fine (user registration, I think post) but when I close the user's session I get this error message:

  

"No route matches [GET]" / users / sign_out "

and then the code that leads to it is:

"<li><%= link_to "Cerrar Sesion", destroy_user_session_path, method: :delete %></li>

    
asked by Juan Carlos Aldana 01.01.2017 в 16:56
source

1 answer

0

For unconventional http verbs to work (like DELETE in the case you use devise), you must add the libraries of unobstructive javascript for Jquery to your application.js :

//= require jquery 
//= require jquery_ujs

Or if not, try opening your file config/initializers/devise.rb , search:

config.sign_out_via = :delete

and change it to:

config.sign_out_via = :get

then simply remove method: :delete of your link:

<li><%= link_to "Cerrar Sesion", destroy_user_session_path %></li>
    
answered by 03.01.2017 / 14:12
source