Help with return_back

I have to log in my app, after the login I want to return back to the
page I was visiting just before the redirect to the login. Now, I have
this in my Sessions controller:

Based on the principle of least surprise, you’ve got two cases you need
plan for:

  1. The user explicitly requests the login page, and so after a
    login, you send him back to the page he came from.
  2. The user requests a protected action that requires login, so you
    redirect to the login page and then, after successful login, take him
    to the
    originally-requested page.

To solve this, you need to store the after-login destination in a
variable based on these rules and depending on whether you get to your
page from a before filter method (classic name here in every example
written is “authorize”) or from an HTTP GET request for your login page.
either case, if the user succeeds in logging in and the variable is set,
reset the session variable and redirect to that location. Otherwise,
redirect to a default location.

Hope this helps…

On Fri, Feb 13, 2009 at 9:22 PM, John S. <