method
type_cast_calculated_value
type_cast_calculated_value(value, column, operation = nil)
private
Hide source
# File activerecord/lib/active_record/calculations.rb, line 296 def type_cast_calculated_value(value, column, operation = nil) if value.is_a?(String) || value.nil? case operation.to_s.downcase when 'count' then value.to_i when 'sum' then type_cast_using_column(value || '0', column) when 'avg' then value.try(:to_d) else type_cast_using_column(value, column) end else value end end