Forum: Ruby on Rails Redirect to the url after login

Posted by Tushar Gandhi (gandhi-tush)
on 2010-03-09 13:39
Hi,
I am using authlogic as a authentication mechanism.
I am sending out an email to user if he has any new friend request. I am
giving a URL in the email from which he can accept the invitation.
My problem is whenever the user is not logged in he is redirected to the
login page first. After successful login he should be redirected to
"accept_friendship" URL But it doesn't it goes to the default page after
successful login.

How should I fix this?

Thanks,
Tushar Gandhi
Posted by Ar Chron (railsdog)
on 2010-03-09 18:28
Tushar Gandhi wrote:
> Hi,
> I am using authlogic as a authentication mechanism.
> I am sending out an email to user if he has any new friend request. I am
> giving a URL in the email from which he can accept the invitation.
> My problem is whenever the user is not logged in he is redirected to the
> login page first. After successful login he should be redirected to
> "accept_friendship" URL But it doesn't it goes to the default page after
> successful login.
> 
> How should I fix this?
> 
> Thanks,
> Tushar Gandhi

There should be lots of rails tutorials out there that speak about 
remembering the original request URL for redirecting after a successful 
login.

http://ethilien.net/archives/better-redirects-in-rails/  is one such 
resource.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.