From 4e3ceedeba4f95d6f51380277c5562049ccdc264 Mon Sep 17 00:00:00 2001 From: hoffm Date: Wed, 20 Feb 2013 16:15:59 -0500 Subject: Address edge case for number_to_human with units option. ActiveSupport::NumberHelper#number_to_human now 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 provided. --- activesupport/lib/active_support/number_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib') 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 -- cgit v1.2.3