method

find_target

Importance_0
Ruby on Rails latest stable (v6.1.7.7) - 0 notes - Class: Association
find_target() private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# 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
Register or log in to add new notes.