Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Redirect back to a previous action (See related posts)

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"


You need to create an account or log in to post comments to this site.


Click here to browse all 4860 code snippets

Related Posts