Skip to content

Instantly share code, notes, and snippets.

@gstark
Created January 18, 2010 15:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save gstark/280099 to your computer and use it in GitHub Desktop.
Save gstark/280099 to your computer and use it in GitHub Desktop.
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