Created
April 4, 2013 05:15
-
-
Save radar/5308002 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
before do | |
ActiveSupport::Notifications.subscribe('sql.active_record') do |name, starts_at, ends_at, id, payload| | |
if /stock_items/.match(payload[:sql]) && /INSERT/.match(payload[:sql]) | |
puts caller.delete_if { |p| !p.include?("/Users/ryan/Sites/gems/spree") }.join("\n") | |
puts "*" * 100 | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is simple and clever.
Where do you put this ?
Given it's a
AS::N
subscribe block I would have put it in an initializer, but thebefore
block is not familiar.Thanks