method

find_target

Importance_0
v6.1.3.1 - Show latest stable - 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 (owner.strict_loading? || reflection.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.