DEV Community

Discussion on: Rails 7 + Devise + Log out

Collapse
 
andyfoster profile image
Andy • Edited

Chim Kan has a way to add Turbo to the link_to method and this worked for me.

<%= link_to "Sign out", destroy_user_session_path, data: { turbo_method: :delete" } %>

chimkan.com/rails-7-and-devise-iss...

Collapse
 
kkamikazi profile image
kkamikazi

The problem on my app is that the redirect will try a DELETE request on the root_path too.

Collapse
 
damuz91 profile image
David Muñoz

Check with rails routes if the route you are trying to use as logout is the proper one. Also check in the rails server console what is the output and what is the route being requested when you click the button.