dev-resources.site
for different kinds of informations.
Rails 7 + Devise + Log out
Published at
2/21/2022
Categories
rails
tutorial
devise
programming
Author
spaquet
Author
7 person written this
spaquet
open
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 button_to
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.
devise Article's
30 articles in total
Devise not accepting JSON Token
read article
Reset password mailer implementation in rails 7 api, devise_token_auth, and sendgrid-ruby.
read article
Ruby on Rails: Autenticação utilizando Devise + Keycloak
read article
How to Install Devise
read article
Warden of Hanami - hanami.rb basic authentication
read article
Devise raise validations error when new and old passwords are same
read article
Hooking in to Devise controller actions
read article
Rails 基礎 Part 06 -- devise でログインをした上で、API UT を叩く
read article
Using Devise and SendGrid to send confirmation email on rails app
read article
Omniauth without Devise
read article
Setting Up User Auth With React and Rails Minus The JWT Headache
read article
How to Backup Android Contacts to Mac Devices?
read article
Signout Users
read article
Rails 7 + Devise + Log out
currently reading
How to Add ToS Agreement Checkbox to Your Rails App using Devise?
read article
Multi-Factor Authentication for Rails with WebAuthn and Devise
read article
Omniauth + Devise + Rails Tutorial
read article
Rails 7.0.0alpha2, esbuild, tailwind and devise
read article
Devise: User + Profile
read article
Rails redirect user to the previous page after signup or login
read article
Devise-ing A Backend...
read article
Devise Cheat Sheet
read article
Rails Authentication with Devise
read article
Extending the default user devise
read article
Using Devise for User Auth
read article
install gem invisible_captcha with devise
read article
Adding a field to your sign-up form with Devise
read article
Declaring multiple sets of scopes for the same provider with Devise and OmniAuth in Rails
read article
Devise and JWT in Rails
read article
Customize Devise’s flash messages
read article
Featured ones: