mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Avoid having to store complex object in the default translation file
This make possible for applications to use the safe mode of yaml to load the translations files. Fixes #41459.
This commit is contained in:
parent
561fa1e165
commit
37303ea499
2 changed files with 2 additions and 2 deletions
|
@ -45,7 +45,7 @@ en:
|
|||
# Number of decimals, behind the separator (the number 1 with a precision of 2 gives: 1.00)
|
||||
precision: 3
|
||||
# Determine how rounding is performed (see BigDecimal::mode)
|
||||
round_mode: !ruby/sym default
|
||||
round_mode: default
|
||||
# If set to true, precision will mean the number of significant digits instead
|
||||
# of the number of decimal digits (1234 with precision 2 becomes 1200, 1.23543 becomes 1.2)
|
||||
significant: false
|
||||
|
|
|
@ -13,7 +13,7 @@ module ActiveSupport
|
|||
precision = absolute_precision(number)
|
||||
return number unless precision
|
||||
|
||||
rounded_number = convert_to_decimal(number).round(precision, options.fetch(:round_mode, :default))
|
||||
rounded_number = convert_to_decimal(number).round(precision, options.fetch(:round_mode, :default).to_sym)
|
||||
rounded_number.zero? ? rounded_number.abs : rounded_number # prevent showing negative zeros
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue