Flowdock
method

build_scope

Importance_0
build_scope() 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/preloader/association.rb, line 137
          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

            if preload_scope && preload_scope.strict_loading_value
              scope.strict_loading
            else
              scope
            end
          end
Register or log in to add new notes.