Match the behavior of bigdecimal after https://github.com/ruby/bigdecimal/pull/55
This commit is contained in:
parent
68926798a5
commit
0683552b15
@ -24,7 +24,11 @@ def cast_value(value)
|
||||
when ::Numeric
|
||||
BigDecimal(value, precision || BIGDECIMAL_PRECISION)
|
||||
when ::String
|
||||
value.to_d rescue BigDecimal(0)
|
||||
begin
|
||||
value.to_d
|
||||
rescue ArgumentError
|
||||
BigDecimal(0)
|
||||
end
|
||||
else
|
||||
if value.respond_to?(:to_d)
|
||||
value.to_d
|
||||
|
Loading…
Reference in New Issue
Block a user