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 385
      def type_cast_calculated_value(value, type, operation = nil)
        case operation
        when "count"   then value.to_i
        when "sum"     then type.deserialize(value || 0)
        when "average" then value && value.respond_to?(:to_d) ? value.to_d : value
        else type.deserialize(value)
        end
      end
Register or log in to add new notes.