Module: ChronoModel::Patches::Preloader::ThroughAssociation

Defined in:
lib/chrono_model/patches/preloader.rb

Instance Method Summary collapse

Instance Method Details

#through_scopeObject

Builds the preloader scope taking into account a potential as_of_time passed down the call chain starting at the end user invocation.



85
86
87
88
89
90
91
92
93
94
# File 'lib/chrono_model/patches/preloader.rb', line 85

def through_scope
  scope = super
  return unless scope # Rails 5.2 may not return a scope

  if preload_scope.try(:as_of_time)
    scope = scope.as_of(preload_scope.as_of_time)
  end

  scope
end