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