A Quick and Dirty way to get the redirection working on Logout when using Devise in a Rails 7 app.
You probably have noticed that most of the redirects in Devise a somehow broken. This is due to the way Turbo interfere with them as it catches the 200 status code.
There are already a lot of posts explaining how to patch this while waiting for an official release. But, if your main issue is about the "redirect on log out" not working, then you can easily fix this.
Instead of calling
destroy_user_session_path in a
link_to, call it inside of a
Here is the full code:
<%= button_to( "Log Out", destroy_user_session_path, method: :delete ) %>
And Voilà! This simple hack enables your users to be redirected to the root_path of your app in seconds.