method

find_target

find_target()
private

No documentation available.

# File activerecord/lib/active_record/associations/association.rb, line 226
        def find_target
          if violates_strict_loading?
            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)
          klass.with_connection do |c|
            sc.execute(binds, c) 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
        end