diff options
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/CHANGELOG.md | 13 | ||||
-rw-r--r-- | activesupport/lib/active_support/number_helper.rb | 2 |
2 files changed, 14 insertions, 1 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index df8cf5f8ec..16000d21b3 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -1,5 +1,18 @@ ## Rails 4.0.0 (unreleased) ## +* `ActiveSupport::NumberHelper#number_to_human` returns the number unaltered when + the units hash does not contain the needed key, e.g. when the number provided is less + than the largest key proivided. + + Examples: + + number_to_human(123, :units => {}) # => 123 + number_to_human(123, :units => {:thousand => 'k'}) # => 123 + + Fixes #9269. + + *Michael Hoffman* + * Added beginning_of_minute support to core_ext calculations for Time and DateTime *Gagan Awhad* diff --git a/activesupport/lib/active_support/number_helper.rb b/activesupport/lib/active_support/number_helper.rb index 2191471daa..cc935e6cb9 100644 --- a/activesupport/lib/active_support/number_helper.rb +++ b/activesupport/lib/active_support/number_helper.rb @@ -580,7 +580,7 @@ module ActiveSupport unit = case units when Hash - units[DECIMAL_UNITS[display_exponent]] + units[DECIMAL_UNITS[display_exponent]] || '' when String, Symbol I18n.translate(:"#{units}.#{DECIMAL_UNITS[display_exponent]}", :locale => options[:locale], :count => number.to_i) else |