Files

Class Index [+]

Quicksearch

ActiveRecord::Explain

Public Class Methods

extended(base) click to toggle source
    # File lib/active_record/explain.rb, line 5
 5:     def self.extended(base)
 6:       base.class_eval do
 7:         # If a query takes longer than these many seconds we log its query plan
 8:         # automatically. nil disables this feature.
 9:         class_attribute :auto_explain_threshold_in_seconds, :instance_writer => false
10:         self.auto_explain_threshold_in_seconds = nil
11:       end
12:     end

Public Instance Methods

silence_auto_explain() click to toggle source

Silences automatic EXPLAIN logging for the duration of the block.

This has high priority, no EXPLAINs will be run even if downwards the threshold is set to 0.

As the name of the method suggests this only applies to automatic EXPLAINs, manual calls to +ActiveRecord::Relation#explain+ run.

    # File lib/active_record/explain.rb, line 77
77:     def silence_auto_explain
78:       current = Thread.current
79:       original, current[:available_queries_for_explain] = current[:available_queries_for_explain], false
80:       yield
81:     ensure
82:       current[:available_queries_for_explain] = original
83:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.