Flowdock
method

cast_value

Importance_0
v5.0.0.1 - Show latest stable - 0 notes - Class: Decimal
cast_value(value) private

No documentation

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

Hide source
# File activemodel/lib/active_model/type/decimal.rb, line 18
      def cast_value(value)
        casted_value = case value
        when ::Float
          convert_float_to_big_decimal(value)
        when ::Numeric, ::String
          BigDecimal(value, precision.to_i)
        else
          if value.respond_to?(:to_d)
            value.to_d
          else
            cast_value(value.to_s)
          end
        end

        apply_scale(casted_value)
      end
Register or log in to add new notes.