From 3351431d9892ea48fd453135489078befe9517f5 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Mon, 10 May 2010 03:33:13 -0300 Subject: [PATCH] value can be a Float here and need to be converted to a BigDecimal [#4514 state:committed] --- .../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 858d298..8fe97c8 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -239,7 +239,7 @@ module ActiveRecord end def type_cast_calculated_value(value, column, operation = nil) - if value.is_a?(String) || value.nil? + if value.is_a?(String) || value.is_a?(Float) || value.nil? case operation when 'count' then value.to_i when 'sum' then type_cast_using_column(value || '0', column) -- 1.7.1