Created
August 13, 2013 08:48
-
-
Save boxofrad/6219171 to your computer and use it in GitHub Desktop.
Handy controller profiling code
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
around_filter :profile | |
def profile | |
if params[:profile] && result = RubyProf.profile { yield } | |
out = StringIO.new | |
RubyProf::GraphHtmlPrinter.new(result).print out, :min_percent => 0 | |
self.response_body = out.string | |
else | |
yield | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment