[Rails] session[:return_to] for going back.

Jeremy Kemper
Wed, 10 May 2006 16:23:19 -0000

On May 10, 2006, at 12:17 AM, Sam Donaldson wrote:
> Is session[:return_to] something Rails maintains to quickly go back
> to the previous uri without having to keep track of the action
> name?  Or, do we have to actually set it in our actions?

(Assuming you''re referring to the earlier url_back code sample.)

You must set it yourself. Rails can''t tell which page you wish to
return to or when such a setting is appropriate.

I like embedding return_to in form parameters because the user can
work with multiple tabs/windows without having one tab return to the
other''s :return_to.

Best,
jeremy