diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-06-02 13:56:22 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-06-02 13:56:22 -0300 |
commit | f71265f7f8b3e284ec713b995c5d5b67557a3ef6 (patch) | |
tree | 15ad774a500e749120505e8932b01a05610abec0 /activesupport/lib/active_support | |
parent | 38454bb2666ca7d258a4ca2b53e16bcc3a2ee019 (diff) | |
parent | 60062cf39a6079cf6a47a754f4b5fc6c474b9b15 (diff) | |
download | rails-f71265f7f8b3e284ec713b995c5d5b67557a3ef6.tar.gz rails-f71265f7f8b3e284ec713b995c5d5b67557a3ef6.tar.bz2 rails-f71265f7f8b3e284ec713b995c5d5b67557a3ef6.zip |
Merge pull request #15379 from xuanxu/rational_precision
Fix AS::NumberHelper results with rationals
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/number_helper/number_to_rounded_converter.rb | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/activesupport/lib/active_support/number_helper/number_to_rounded_converter.rb b/activesupport/lib/active_support/number_helper/number_to_rounded_converter.rb index c45f6cdcfa..01597b288a 100644 --- a/activesupport/lib/active_support/number_helper/number_to_rounded_converter.rb +++ b/activesupport/lib/active_support/number_helper/number_to_rounded_converter.rb @@ -12,11 +12,7 @@ module ActiveSupport when Float, String @number = BigDecimal(number.to_s) when Rational - if significant - @number = BigDecimal(number, digit_count(number.to_i) + precision) - else - @number = BigDecimal(number, precision) - end + @number = BigDecimal(number, digit_count(number.to_i) + precision) else @number = number.to_d end |