Sha256: bed388fb9e272dee6001ab69d76e2cb03e6f151c388d97c4f77dd3f32af390e4
Contents?: true
Size: 740 Bytes
Versions: 3
Compression:
Stored size: 740 Bytes
Contents
# frozen_string_literal: true module N1Loader module ArLazyPreload # Context adapter for N1Loader class ContextAdapter attr_reader :context delegate :records, :auto_preload?, to: :context def initialize(context) @context = context end def try_preload_lazily(association_name) return unless context&.send(:association_needs_preload?, association_name) perform_preloading(association_name) end def perform_preloading(association_name) N1Loader::Preloader.new(records).preload(association_name) AssociatedContextBuilder.prepare( parent_context: self, association_name: association_name ) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems