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



58
59
60
# File 'lib/predictive_load/active_record_collection_observation.rb', line 58

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

#unscopedObject



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/predictive_load/active_record_collection_observation.rb', line 45

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