method

build_scope

rails latest stable - Class: ActiveRecord::Associations::Preloader::Association

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v7.0.0) is shown here.

build_scope()
private

No documentation available.

# File activerecord/lib/active_record/associations/preloader/association.rb, line 269
          def build_scope
            scope = klass.scope_for_association

            if reflection.type && !reflection.through_reflection?
              scope.where!(reflection.type => model.polymorphic_name)
            end

            scope.merge!(reflection_scope) unless reflection_scope.empty_scope?

            if preload_scope && !preload_scope.empty_scope?
              scope.merge!(preload_scope)
            end

            cascade_strict_loading(scope)
          end