how to stay on page after login ?

16 views
Skip to first unread message

eben sinaga

unread,
Jul 9, 2017, 3:03:29 AM7/9/17
to Ruby on Rails: Talk
Hi,

I have one questions, how to stay on page after login ? should i create session url or something else ?

Cheers

Robby O'Connor

unread,
Jul 9, 2017, 3:08:08 AM7/9/17
to rubyonra...@googlegroups.com
If you use something like devise.. it's more or less done for you.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/de87baad-9125-48f8-9abd-8031b133e20c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

eben sinaga

unread,
Jul 9, 2017, 5:59:02 AM7/9/17
to Ruby on Rails: Talk
I don't use devise


On Sunday, 9 July 2017 14:08:08 UTC+7, Robert O'Connor wrote:
If you use something like devise.. it's more or less done for you.
On Jul 9, 2017 3:03 AM, "eben sinaga" <ebenpe...@gmail.com> wrote:
Hi,

I have one questions, how to stay on page after login ? should i create session url or something else ?

Cheers

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.

Walter Lee Davis

unread,
Jul 9, 2017, 10:44:35 AM7/9/17
to rubyonra...@googlegroups.com
The way Devise does this (in broad terms) is that on any page where you check for authentication (before_action :authenticate_user!) that method first checks to see if you are already signed in, if not, it stores the location of the page where you are in a cookie, then redirects you to the new session path, if you are successful in authenticating, then the session create method removes your original destination from the cookie, and redirects you there.

Walter
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/6e81c04d-1d2d-4051-aea3-4595e46d752a%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages