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



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

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

#unscopedObject



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

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