Flowdock
method

type_cast_calculated_value

Importance_0
type_cast_calculated_value(value, operation) 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 448
      def type_cast_calculated_value(value, operation)
        case operation
        when "count"
          value.to_i
        when "sum"
          yield value || 0
        when "average"
          value&.respond_to?(:to_d) ? value.to_d : value
        else # "minimum", "maximum"
          yield value
        end
      end
Register or log in to add new notes.