diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-12-28 23:09:50 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-12-28 23:09:50 -0800 |
commit | 160af90ac02a566d4d56bed6d7fa5e5026375a70 (patch) | |
tree | a587b9ee2b0a9c7f5ce4b60144529f62198452e3 /activerecord/lib | |
parent | 8faf2b3d49cadd28509447edb0452dd7bfecbe5c (diff) | |
download | rails-160af90ac02a566d4d56bed6d7fa5e5026375a70.tar.gz rails-160af90ac02a566d4d56bed6d7fa5e5026375a70.tar.bz2 rails-160af90ac02a566d4d56bed6d7fa5e5026375a70.zip |
fix time typcasting on group counts in PG
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/relation/calculations.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index 70d07fdd36..29f205450d 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -274,7 +274,7 @@ module ActiveRecord column_alias_for(field) } group_columns = group_aliases.zip(group_fields).map { |aliaz,field| - [aliaz, column_for(field)] + [aliaz, field] } group = group_fields @@ -314,7 +314,10 @@ module ActiveRecord end Hash[calculated_data.map do |row| - key = group_columns.map { |aliaz, column| + key = group_columns.map { |aliaz, column_name| + column = calculated_data.column_types.fetch(aliaz) do + column_for(column_name) + end type_cast_calculated_value(row[aliaz], column) } key = key.first if key.size == 1 |