Skip to content

Instantly share code, notes, and snippets.

@hpneo
Created October 28, 2012 23:53
Show Gist options
  • Save hpneo/3970511 to your computer and use it in GitHub Desktop.
Save hpneo/3970511 to your computer and use it in GitHub Desktop.
after_filter :store_location
def store_location
session[:previous_urls] ||= []
session[:previous_urls].unshift request.fullpath if session[:previous_urls].first != request.fullpath
session[:previous_urls].pop if session[:previous_urls].count > 2
end
def after_sign_in_path_for(resource)
session[:previous_urls].last || root_path
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment