Hello all,
I am using acts_as_authenticated as my login system.
it does a good job redirecting back to where the user were after
login, when using the controller action fliter.
however if i use a link in my page to link to the login page, it
doesn’t redirect back to where the user were after login.
i have a look at the code of AAA, it uses
- redirect_back_or_default(:controller => ‘/account’, :action =>
‘index’) - #code for redirect_back_or_default
-
def redirect_back_or_default(default)
-
session[:return_to] ?
redirect_to_url(session[:return_to]) : redirect_to(default)
6. session[:return_to] = nil
7. end
to redirect back to the origin page.
how and where to set the session[:return] in my app to make it
redirect back to the origin page after login?
Thanks all.