diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-11-30 16:51:03 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-11-30 16:51:03 -0800 |
commit | f1758525f940eb6c4dd4178784db2ba66316083d (patch) | |
tree | c71f52040aabd68ba2ad711646f87d079701ce56 /activerecord | |
parent | 39f5fc06cb5661b93275e3f7bf98e63b98b57550 (diff) | |
download | rails-f1758525f940eb6c4dd4178784db2ba66316083d.tar.gz rails-f1758525f940eb6c4dd4178784db2ba66316083d.tar.bz2 rails-f1758525f940eb6c4dd4178784db2ba66316083d.zip |
reduce method calls on arel
Diffstat (limited to 'activerecord')
3 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index c8adaddfca..013b878293 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -166,7 +166,7 @@ module ActiveRecord 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 diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 23ae0b4325..1da7411589 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -196,7 +196,7 @@ module ActiveRecord 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 diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index 0a4c119849..1eb7f04bdf 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -180,7 +180,7 @@ module ActiveRecord arel.join(join) end - arel.joins(arel) + arel.join_sql end def build_arel |