Class: ArLazyPreload::Contexts::LazyPreloadContext
- Inherits:
-
BaseContext
- Object
- BaseContext
- ArLazyPreload::Contexts::LazyPreloadContext
- Defined in:
- lib/ar_lazy_preload/contexts/lazy_preload_context.rb
Overview
This class is responsible for lazy preloading. It contains a tree of associations, which were requested to be loaded lazily.
Instance Attribute Summary collapse
-
#association_tree ⇒ Object
readonly
Returns the value of attribute association_tree.
Attributes inherited from BaseContext
Instance Method Summary collapse
-
#initialize(records:, association_tree:) ⇒ LazyPreloadContext
constructor
:records - array of ActiveRecord instances :association_tree - list of symbols or hashes representing a tree of preloadable associations.
Methods inherited from BaseContext
#auto_preload?, #try_preload_lazily
Constructor Details
#initialize(records:, association_tree:) ⇒ LazyPreloadContext
:records - array of ActiveRecord instances :association_tree - list of symbols or hashes representing a tree of preloadable associations
13 14 15 16 17 |
# File 'lib/ar_lazy_preload/contexts/lazy_preload_context.rb', line 13 def initialize(records:, association_tree:) @association_tree = association_tree super(records: records) end |
Instance Attribute Details
#association_tree ⇒ Object (readonly)
Returns the value of attribute association_tree.
8 9 10 |
# File 'lib/ar_lazy_preload/contexts/lazy_preload_context.rb', line 8 def association_tree @association_tree end |