method

build_scope

build_scope()
private

No documentation available.

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

          scope = scope.where(process_conditions(options[:conditions]))
          scope = scope.where(process_conditions(preload_options[:conditions]))

          scope = scope.select(preload_options[:select] || options[:select] || table[Arel.star])
          scope = scope.includes(preload_options[:include] || options[:include])

          if options[:as]
            scope = scope.where(
              klass.table_name => {
                reflection.type => model.base_class.sti_name
              }
            )
          end

          scope
        end