Created
January 18, 2010 15:32
-
-
Save gstark/280099 to your computer and use it in GitHub Desktop.
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
module SQLGrowler | |
class Subscriber < ActiveRecord::Railties::Subscriber | |
def sql(event) | |
super | |
g('%s (%.1fms) %s' % [event.payload[:name], event.duration, event.payload[:sql].squeeze(' ')]) | |
end | |
end | |
def self.enable | |
if Kernel.respond_to?(:g) | |
Rails::Subscriber.add :active_record, SQLGrowler::Subscriber.new | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment