diff options
author | Yves Senn <yves.senn@gmail.com> | 2013-12-10 05:29:25 -0800 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2013-12-10 05:29:25 -0800 |
commit | 821153525cefb1a809be06ae584f24f5c0c11323 (patch) | |
tree | 0805065b06a20007a7c5ca7dbacee802d5a3ece5 /activerecord/lib/active_record | |
parent | 900191fe2c7eea88c625deb824e995bc7b5e914d (diff) | |
parent | 2a7fe7ae9b09024acea3c5d525c89b91bdb264a1 (diff) | |
download | rails-821153525cefb1a809be06ae584f24f5c0c11323.tar.gz rails-821153525cefb1a809be06ae584f24f5c0c11323.tar.bz2 rails-821153525cefb1a809be06ae584f24f5c0c11323.zip |
Merge pull request #13236 from jetthoughts/13230_type_cast_bug_in_agr_functions
Fix type cast on group sum with custom expression
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/relation/calculations.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index 2d267183ce..cf24d10a8d 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -311,7 +311,9 @@ module ActiveRecord } key = key.first if key.size == 1 key = key_records[key] if associated - [key, type_cast_calculated_value(row[aggregate_alias], column_for(column_name), operation)] + + column_type = calculated_data.column_types.fetch(aggregate_alias) { column_for(column_name) } + [key, type_cast_calculated_value(row[aggregate_alias], column_type, operation)] end] end |