diff options
author | Ken Collins <ken@metaskills.net> | 2017-09-22 21:33:14 -0400 |
---|---|---|
committer | Ken Collins <ken@metaskills.net> | 2017-09-22 21:33:14 -0400 |
commit | cfc461c3f8ee3a5f35fb05c75e492176c4d8854a (patch) | |
tree | 3e130c8bb24aa55e9f993f1fa30b12eed2d9f090 /activerecord | |
parent | b798c5b796f58a9286e1a037db4453750cd26f95 (diff) | |
download | rails-cfc461c3f8ee3a5f35fb05c75e492176c4d8854a.tar.gz rails-cfc461c3f8ee3a5f35fb05c75e492176c4d8854a.tar.bz2 rails-cfc461c3f8ee3a5f35fb05c75e492176c4d8854a.zip |
Ensure `1 AS one` for SQL Server with calculations.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/relation/calculations.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index 42d43224fa..0889d61c92 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -391,7 +391,7 @@ module ActiveRecord def build_count_subquery(relation, column_name, distinct) relation.select_values = [ if column_name == :all - distinct ? table[Arel.star] : Arel.sql("1") + distinct ? table[Arel.star] : Arel.sql(FinderMethods::ONE_AS_ONE) else column_alias = Arel.sql("count_column") aggregate_column(column_name).as(column_alias) |