Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redirect to current page rails

I have a sign in form in my application nav bar and I was wondering if there is an easy way to have to sign_in redirect to whatever page you are currently on when you sign_in. Thanks!

like image 886
user2136807 Avatar asked Jul 11 '13 19:07

user2136807


1 Answers

You can redirect_to(:back), as long as a referrer is given. However, I'd recommend that you take a look at this answer, as the solution presented there will be resilient to things like failed logins and OAuth redirects.

like image 106
Chris Heald Avatar answered Oct 16 '22 04:10

Chris Heald