提交 f1758525 编写于 作者: A Aaron Patterson

reduce method calls on arel

上级 39f5fc06
......@@ -166,7 +166,7 @@ def perform_calculation(operation, column_name, options = {})
if operation == "count"
column_name ||= (select_for_count || :all)
if arel.joins(arel) =~ /LEFT OUTER/i
if arel.join_sql =~ /LEFT OUTER/i
distinct = true
column_name = @klass.primary_key if column_name == :all
end
......
......@@ -196,7 +196,7 @@ def find_with_associations
def construct_relation_for_association_calculations
including = (@eager_load_values + @includes_values).uniq
join_dependency = ActiveRecord::Associations::ClassMethods::JoinDependency.new(@klass, including, arel.joins(arel))
join_dependency = ActiveRecord::Associations::ClassMethods::JoinDependency.new(@klass, including, arel.join_sql)
relation = except(:includes, :eager_load, :preload)
apply_join_dependency(relation, join_dependency)
end
......
......@@ -180,7 +180,7 @@ def custom_join_sql(*joins)
arel.join(join)
end
arel.joins(arel)
arel.join_sql
end
def build_arel
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册