module SqlSpy

Constants

Query

Public Class Methods

track() { || ... } click to toggle source
# File lib/sql_spy.rb, line 39
def self.track
  tracker = Tracker.new

  ActiveSupport::Notifications.subscribe("sql.active_record", tracker)
  yield
  ActiveSupport::Notifications.unsubscribe(tracker)

  tracker.queries
end