Over a million developers have joined DZone.

Redirect Back To A Previous Action

·
I am pasting this verbatim from LoginSystem


# move to the last store_location call or to the passed default one
  def redirect_back_or_default(default)
    if @session[:return_to].nil?
      redirect_to default
    else
      redirect_to_url @session[:return_to]
      @session[:return_to] = nil
    end
  end


In your controller...


 redirect_back_or_default :controller => "myfuel", :action => "index"

Topics:

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}