class ActiveRecord::Associations::Association
def find_target
def find_target if violates_strict_loading? && owner.validation_context.nil? Base.strict_loading_violation!(owner: owner.class, reflection: reflection) end scope = self.scope return scope.to_a if skip_statement_cache?(scope) sc = reflection.association_scope_cache(klass, owner) do |params| as = AssociationScope.create { params.bind } target_scope.merge!(as.scope(self)) end binds = AssociationScope.get_bind_values(owner, reflection.chain) sc.execute(binds, klass.connection) do |record| set_inverse_instance(record) if owner.strict_loading_n_plus_one_only? && reflection.macro == :has_many record.strict_loading! else record.strict_loading!(false, mode: owner.strict_loading_mode) end end end