Created
April 10, 2012 14:47
-
-
Save kinopyo/2351857 to your computer and use it in GitHub Desktop.
rails redirect referrer, redirect back with default
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def redirect_back_or_default(default) | |
redirect_to(session[:return_to] || default) | |
session[:return_to] = nil | |
end | |
def redirect_referrer_or_default(default) | |
redirect_to(request.referrer || default) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment