D
D
Dmitry2016-03-16 12:45:59
Ruby on Rails
Dmitry, 2016-03-16 12:45:59

How to check for a session in Rails using the Devise gem and its Rememberable module?

Hello.
I'm a total newbie, so don't kick too hard. In general, I'm trying to organize authorization here using the Devise gem. Made as it is written in this dock . But I need that at the start of the application there would be a check for the presence of a saved user session and if it is, then there would be an automatic redirect, and if not, then a redirect to the registration page. I realized that the Rememberable module is responsible for this, but how to implement it .... I didn’t understand what I googled ... I really hope for advice ....

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Radushevsky, 2016-03-16
@doromones

ApplicationController
before_action ->{redirect_to your_desired path unless user_signed_in? }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question