mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Another Ruby 2.6 BigDecimal compatibility issue
This patch modifies XmlMini::Parsing["decimal"] to handle a string that
contains an invalid number. Since [ruby/ruby@a0e438c#diff-6b866d482baf2bdfd8433893fb1f6d36R144](a0e438cd3c (diff-6b866d482baf2bdfd8433893fb1f6d36R144)
) this case raises an `ArgumentError`. `String.to_f` returns 0.0 if there is not a valid number at the start of the argument, so current behavior is conserved.
See https://travis-ci.org/rails/rails/jobs/463180341#L6264
Related: #34600, #34601
This commit is contained in:
parent
609c58bfa6
commit
ab631b363e
1 changed files with 1 additions and 1 deletions
|
@ -71,7 +71,7 @@ module ActiveSupport
|
|||
begin
|
||||
BigDecimal(number)
|
||||
rescue ArgumentError
|
||||
BigDecimal("0")
|
||||
BigDecimal(number.to_f.to_s)
|
||||
end
|
||||
else
|
||||
BigDecimal(number)
|
||||
|
|
Loading…
Reference in a new issue