Skip to content

Instantly share code, notes, and snippets.

View lwille's full-sized avatar
🏳️‍🌈
🤠

Leonhardt Wille lwille

🏳️‍🌈
🤠
View GitHub Profile
module SQLGrowler
class Subscriber < ActiveRecord::Railties::Subscriber
attr :prev_subscriber
def initialize prev
@prev_subscriber = prev
@g = Growl.new("localhost", "ruby-growl", ["ruby-growl Notification"], ["ruby-growl Notification"], nil)
end
def sql(event)
super
@g.notify('ruby-growl Notification',Rails.application.root.split().last.to_s.capitalize,'%s (%.1fms) %s' % [event.payload[:name], event.duration, event.payload[:sql].squeeze(' ')],1,true)