diff options
author | Xavier Noria <fxn@hashref.com> | 2011-12-04 13:27:03 -0800 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2011-12-04 13:27:03 -0800 |
commit | 7f3ce35e1947c31233263a2cd48740646f5585b3 (patch) | |
tree | 75d2ea7498a44c47a68cdb8cebad227067672540 /activerecord | |
parent | d59bfeb1197960277f66ddb76ca544d8472ab8af (diff) | |
download | rails-7f3ce35e1947c31233263a2cd48740646f5585b3.tar.gz rails-7f3ce35e1947c31233263a2cd48740646f5585b3.tar.bz2 rails-7f3ce35e1947c31233263a2cd48740646f5585b3.zip |
simplifies ActiveRecord::ExplainSubscriber [José Valim & Xavier Noria]
Diffstat (limited to 'activerecord')
-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 |