From 8020b2ca04a9591d9af783ac6d40f7272ee0339c Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Mon, 10 May 2010 03:38:52 -0300 Subject: [PATCH] value can be a Float here and need to be converted to a BigDecimal --- activerecord/lib/active_record/calculations.rb | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/activerecord/lib/active_record/calculations.rb b/activerecord/lib/active_record/calculations.rb index a44f090..003a201 100644 --- a/activerecord/lib/active_record/calculations.rb +++ b/activerecord/lib/active_record/calculations.rb @@ -294,7 +294,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.to_s.downcase when 'count' then value.to_i when 'sum' then type_cast_using_column(value || '0', column) -- 1.7.1