Skip to content

Instantly share code, notes, and snippets.

@agraves
Created January 26, 2012 07:21
Show Gist options
  • Save agraves/1681499 to your computer and use it in GitHub Desktop.
Save agraves/1681499 to your computer and use it in GitHub Desktop.
Trace redirects
# 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