Created
January 26, 2012 07:21
-
-
Save agraves/1681499 to your computer and use it in GitHub Desktop.
Trace redirects
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
# Source: http://jkfill.com/2011/05/13/log-which-line-called-redirect_to/ | |
# | |
# Toss this in ApplicationController and all redirects will generate a log statement | |
unless Rails.env.production? | |
def redirect_to(options = {}, response_status = {}) | |
::Rails.logger.error("Redirected by #{caller(1).first rescue "unknown"}") | |
super(options, response_status) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment