Module: Pipeloader::Batch::LoadInterceptor
- Defined in:
- lib/pipeloader/batch/load_interceptor.rb
Overview
Prepended onto AR’s SingularAssociation (belongs_to / has_one). When a batch-declared association’s target is first loaded for one record, it is loaded for ALL live siblings in the current Context at once (via AR’s own Preloader). Non-batch associations, and models that don’t include Pipeloader::Batch::Model, fall straight through to normal AR.
Instance Method Summary collapse
Instance Method Details
#load_target ⇒ Object
11 12 13 14 |
# File 'lib/pipeloader/batch/load_interceptor.rb', line 11 def load_target Pipeloader::Batch.batch_fill(self) unless loaded? super end |