Ruby on Rails Monday, January 23, 2012

On Jan 23, 12:46 am, Don <don.leat...@gmail.com> wrote:
> I've run in to a strange situation where it would be great if there were a
> way to use " redirect_to :back " to skip back over the previous page and go
> to the previous, previous page ( :back X 2.)  Any one have any ideas how to
> do this?

The best thing that you can do is store the link where you want the
application to redirect_to in a later stage
and use it with the redirect_to syntax

eg:
session[:return_to] = request.fullpath (use this inside the controller
action where you would like to redirect to)
and then use
redirect_to session[:return_to]

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment