diff --git a/activemodel/lib/active_model/type/decimal.rb b/activemodel/lib/active_model/type/decimal.rb index b4ba8d4b1f..e6805c5f6b 100644 --- a/activemodel/lib/active_model/type/decimal.rb +++ b/activemodel/lib/active_model/type/decimal.rb @@ -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