Module: ArLazyPreload::Base

Defined in:
lib/ar_lazy_preload/active_record/base.rb

Overview

ActiveRecord::Base patch with lazy preloading support

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#lazy_preload_contextObject

Returns the value of attribute lazy_preload_context.



10
11
12
# File 'lib/ar_lazy_preload/active_record/base.rb', line 10

def lazy_preload_context
  @lazy_preload_context
end

Class Method Details

.included(base) ⇒ Object



6
7
8
# File 'lib/ar_lazy_preload/active_record/base.rb', line 6

def self.included(base)
  base.class.delegate :lazy_preload, to: :all
end

Instance Method Details

#skip_preloadObject



14
15
16
17
18
# File 'lib/ar_lazy_preload/active_record/base.rb', line 14

def skip_preload
  lazy_preload_context&.records&.delete(self)
  self.lazy_preload_context = nil
  self
end