diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2010-05-12 01:47:58 -0300 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2010-05-11 22:29:26 -0700 |
commit | 5f3bd55726703e08ba595555e1cf428c57832603 (patch) | |
tree | 2d715460c95d1928ff7abe63af7fdb6b2ad35e21 /activerecord/lib | |
parent | 75ddbfecde6452b233540c67b93057f124726638 (diff) | |
download | rails-5f3bd55726703e08ba595555e1cf428c57832603.tar.gz rails-5f3bd55726703e08ba595555e1cf428c57832603.tar.bz2 rails-5f3bd55726703e08ba595555e1cf428c57832603.zip |
type_cast_calculated_value refactor: value is never a Fixnum here. Fix test since SQLite returns Float.
[#4514 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activerecord/lib')
-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 858d298470..0e11f89c8b 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -243,7 +243,7 @@ module ActiveRecord case operation when 'count' then value.to_i when 'sum' then type_cast_using_column(value || '0', column) - when 'average' then value && (value.is_a?(Fixnum) ? value.to_f : value).to_d + when 'average' then value.try(:to_d) else type_cast_using_column(value, column) end else |