I’m trying to use session[:user.return_to] but with no success…
My code:
def after_sign_in_path_for(resource)
(session[:"user.return_to"].nil?) ? "/" : session[:"user.return_to"].to_s
end
So, the problem is: When I check my session variables, I don’t have any with those names.
I would like to get to the page I was working on, right before being redirected to the login page.
Struggling with the same problem. I have a so-so solution so far like so..
In my application_controller.rb
The unless statement is to prevent the user from being returned to the sign in or sign out page. I don’t like that the url is hardcoded in here, so I’d like to see a better solution. Also it seems that before_filter never happens on a page which is redirected to the login page, so if you click something that requires sign in, after sign in you will be taken back to the page from where you clicked the link, not the actual link itself.