Skip to content

Instantly share code, notes, and snippets.

@guimello
Forked from gstark/sqlgrowler.rb
Created December 22, 2010 01:03
Show Gist options
  • Save guimello/750918 to your computer and use it in GitHub Desktop.
Save guimello/750918 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