Module: N1Loader::ArLazyPreload::PreloaderPatch
- Included in:
- Preloader
- Defined in:
- lib/n1_loader/ar_lazy_preload/preloader_patch.rb
Overview
A patch to Preloader setup lazy context lazily.
Instance Method Summary collapse
Instance Method Details
#initialize(elements, context_setup = nil) ⇒ Object
7 8 9 10 |
# File 'lib/n1_loader/ar_lazy_preload/preloader_patch.rb', line 7 def initialize(elements, context_setup = nil) super(elements) @context_setup = context_setup end |
#preload(*keys) ⇒ Object
12 13 14 15 16 |
# File 'lib/n1_loader/ar_lazy_preload/preloader_patch.rb', line 12 def preload(*keys) super.each do |loader_collection| loader_collection.context_setup = context_setup end end |