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
-
#lazy_preload_context ⇒ Object
Returns the value of attribute lazy_preload_context.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#lazy_preload_context ⇒ Object
Returns the value of attribute lazy_preload_context.
11 12 13 |
# File 'lib/ar_lazy_preload/active_record/base.rb', line 11 def lazy_preload_context @lazy_preload_context end |
Class Method Details
.included(base) ⇒ Object
6 7 8 9 |
# File 'lib/ar_lazy_preload/active_record/base.rb', line 6 def self.included(base) base.class.delegate :lazy_preload, to: :all base.class.delegate :preload_associations_lazily, to: :all end |
Instance Method Details
#skip_preload ⇒ Object
15 16 17 18 19 |
# File 'lib/ar_lazy_preload/active_record/base.rb', line 15 def skip_preload lazy_preload_context&.records&.delete(self) self.lazy_preload_context = nil self end |