Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module SQLGrowler
- class Subscriber < ActiveRecord::LogSubscriber
- def sql(event)
- super
- g = Growl.new("localhost", "ruby-growl", ["ruby-growl Notification"], ["ruby-growl Notification"], nil)
- g.notify('ruby-growl Notification',application_name,'%s (%.1fms) %s' % [event.payload[:name], event.duration, event.payload[:sql].squeeze(' ')],1,true)
- end
- def application_name
- @application_name ||= Rails.application.class.parent_name
- end
- end
- end
- SQLGrowler::Subscriber.attach_to :active_record
Add Comment
Please, Sign In to add comment