devise gem Awareness Note: Redirect specs

In application development, when I implemented the user management function using devise before creating the top page, I noticed the devise redirect specification that seemed to be known but not known, so I will keep it as a record.

How did you notice the devise specifications?

Before creating the top page, I implemented the new registration function with devise and checked the operation in the local environment (localhost: 3000), and after the new registration, I redirected to the familiar top page of Rails. スクリーンショット 2021-01-07 21.47.12.png

Redirect to root path after new registration process

After processing the new registration function (controller: devise/registration # create), you will be redirected to the root path (root_path).

If you haven't set the root path (root_path) in route.rb, you'll see the Rails familiar top page.

Redirect to login screen after logout process

After processing the logout function (controller: devise/sessions # destroy), you will be redirected to the login screen (controller: devise/sessions # new).

When I noticed the above-mentioned new registration → redirect to the root path and wondered "Where will I be redirected after logging out?", I found that it was redirected to the login screen.

Recommended Posts

devise gem Awareness Note: Redirect specs
[Rails] gem devise installation flow
[Japanese localization of gem: devise]