method
find_target
v6.1.7.7 -
Show latest stable
- Class:
ActiveRecord::Associations::Association
find_target()private
No documentation available.
# File activerecord/lib/active_record/associations/association.rb, line 213
def find_target
if 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) { |record| set_inverse_instance(record) }
end