Module: PredictiveLoad::ActiveRecordCollectionObservation::UnscopedTracker

Defined in:
lib/predictive_load/active_record_collection_observation.rb

Overview

disable eager loading since includes + unscoped is broken on rails 4

Instance Method Summary collapse

Instance Method Details

#predictive_load_disabledObject



54
55
56
# File 'lib/predictive_load/active_record_collection_observation.rb', line 54

def predictive_load_disabled
  Thread.current[:predictive_load_disabled] ||= []
end

#unscopedObject



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/predictive_load/active_record_collection_observation.rb', line 40

def unscoped
  if block_given?
    begin
      predictive_load_disabled << self
      super
    ensure
      predictive_load_disabled.pop
    end
  else
    super
  end
end