aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/explain_subscriber.rb
blob: aa5cf263a60476d6acf0f1447418429af54f64cd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
require 'active_support/notifications'

module ActiveRecord
  class ExplainSubscriber
    def call(*args)
      ActiveRecord::Base.collect_queries_for_explain(args.last)
    end

    ActiveSupport::Notifications.subscribe("sql.active_record", new)
  end
end