method
cast_value
cast_value(value)
private
Hide source
# File activerecord/lib/active_record/type/decimal.rb, line 16 def cast_value(value) casted_value = case value when ::Float convert_float_to_big_decimal(value) when ::Numeric BigDecimal(value, precision.to_i) when ::String begin value.to_d rescue ArgumentError BigDecimal(0) end else if value.respond_to?(:to_d) value.to_d else cast_value(value.to_s) end end apply_scale(casted_value) end