You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BigDecimal#new has been marked for deprecation for awhile and it looks like it finally happened in Ruby 2.7? This broke our configuration that used #new as the parser:
element :payment, BigDecimal, :tag => 'payment', :parser => :new
I have been able to register a new SupportedType and get the new syntax working:
module HappyMapper
module SupportedTypes
register_type BigDecimal do |value|
BigDecimal(value) if value && !value.empty?
end
end
end
Is the right approach or am I missing some other way to solve this issue?
The text was updated successfully, but these errors were encountered:
Yes, I think that's the best way if you want to have the exact same behavior.
An alternative option is to parse using BigDecimal.interpret_loosely. That method is a bit more forgiving so it will accept "4.2 hello", whereas BigDecimal() will not:
element :payment, BigDecimal, :tag => 'payment', :parser => :interpret_loosely
BigDecimal#new
has been marked for deprecation for awhile and it looks like it finally happened in Ruby 2.7? This broke our configuration that used#new
as the parser:I have been able to register a new
SupportedType
and get the new syntax working:Is the right approach or am I missing some other way to solve this issue?
The text was updated successfully, but these errors were encountered: