Created
June 26, 2010 00:43
-
-
Save bakineggs/453645 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # if you want to figure out wtf is calling Foo::Bar#baz, just | |
| class Foo::Bar | |
| def baz_with_backtrace *args | |
| begin | |
| raise | |
| rescue => e | |
| puts 'backtrace to who called Foo::Bar#baz:' | |
| puts e.backtrace.join("\n") | |
| end | |
| baz_without_backtrace *args | |
| end | |
| alias_method_chain :baz, :backtrace # if you use ActiveSupport, otherwise uncomment the next two lines | |
| # alias_method :baz_without_backtrace, :baz | |
| # alias_method :baz, :baz_with_backtrace | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment