Flowdock
type_cast_calculated_value(value, type, operation = nil) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/relation/calculations.rb, line 377
    def type_cast_calculated_value(value, type, operation = nil)
      case operation
        when 'count'   then value.to_i
        when 'sum'     then type.type_cast_from_database(value || 0)
        when 'average' then value.respond_to?(:to_d) ? value.to_d : value
        else type.type_cast_from_database(value)
      end
    end
Register or log in to add new notes.