diff options
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/explain_subscriber.rb | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/explain_subscriber.rb b/activerecord/lib/active_record/explain_subscriber.rb index 8a88be6761..aa5cf263a6 100644 --- a/activerecord/lib/active_record/explain_subscriber.rb +++ b/activerecord/lib/active_record/explain_subscriber.rb @@ -1,13 +1,11 @@ -module ActiveRecord - class ExplainSubscriber < ActiveSupport::LogSubscriber - def sql(event) - ActiveRecord::Base.collect_queries_for_explain(event.payload) - end +require 'active_support/notifications' - def logger - ActiveRecord::Base.logger +module ActiveRecord + class ExplainSubscriber + def call(*args) + ActiveRecord::Base.collect_queries_for_explain(args.last) end - attach_to :active_record + ActiveSupport::Notifications.subscribe("sql.active_record", new) end end |