Flowdock
method

through_scope

Importance_0
through_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/through_association.rb, line 82
          def through_scope
            scope = through_reflection.klass.unscoped
            values = reflection_scope.values

            if options[:source_type]
              scope.where! reflection.foreign_type => options[:source_type]
            else
              unless reflection_scope.where_clause.empty?
                scope.includes_values = Array(values[:includes] || options[:source])
                scope.where_clause = reflection_scope.where_clause
                if joins = values[:joins]
                  scope.joins!(source_reflection.name => joins)
                end
                if left_outer_joins = values[:left_outer_joins]
                  scope.left_outer_joins!(source_reflection.name => left_outer_joins)
                end
              end

              scope.references! values[:references]
              if scope.eager_loading? && order_values = values[:order]
                scope = scope.order(order_values)
              end
            end

            scope
          end
Register or log in to add new notes.