diff options
-rw-r--r-- | activerecord/lib/active_record/relation/calculations.rb | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index 64edcc1ef3..91c1e14028 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -166,8 +166,7 @@ module ActiveRecord if operation == "count" column_name ||= (select_for_count || :all) - joins = arel.joins(arel) - if joins.present? && joins =~ /LEFT OUTER/i + if arel.joins(arel) =~ /LEFT OUTER/i distinct = true column_name = @klass.primary_key if column_name == :all end |