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:

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

{{ parent.tldr }}

{{ parent.urlSource.name }}