diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2007-01-26 21:49:36 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2007-01-26 21:49:36 +0000 |
commit | 28e77c9216850af9666c126fd51294c11bacc9b0 (patch) | |
tree | bca6bbcb4d20a58ae2e219ba7c655a5925088942 /actionpack/lib/action_view | |
parent | 0aa0c84c179e82a2c7d206e75a5d515b82deeba5 (diff) | |
download | rails-28e77c9216850af9666c126fd51294c11bacc9b0.tar.gz rails-28e77c9216850af9666c126fd51294c11bacc9b0.tar.bz2 rails-28e77c9216850af9666c126fd51294c11bacc9b0.zip |
Fixed NumberHelper#number_with_delimiter to use "." always for splitting the original number, not the delimiter parameter (closes #7389) [ceefour]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6045 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/helpers/number_helper.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/actionpack/lib/action_view/helpers/number_helper.rb b/actionpack/lib/action_view/helpers/number_helper.rb index 979ba03f0c..5f774143db 100644 --- a/actionpack/lib/action_view/helpers/number_helper.rb +++ b/actionpack/lib/action_view/helpers/number_helper.rb @@ -94,16 +94,16 @@ module ActionView end # Formats a +number+ with grouped thousands using +delimiter+. You - # can customize the format in the +options+ hash. - # * <tt>:delimiter</tt> - Sets the thousands delimiter, defaults to "," - # * <tt>:separator</tt> - Sets the separator between the units, defaults to "." + # can customize the format using optional <em>delimiter</em> and <em>separator</em> parameters. + # * <tt>delimiter</tt> - Sets the thousands delimiter, defaults to "," + # * <tt>separator</tt> - Sets the separator between the units, defaults to "." # # number_with_delimiter(12345678) => 12,345,678 # number_with_delimiter(12345678.05) => 12,345,678.05 - # number_with_delimiter(12345678, :delimiter => ".") => 12.345.678 + # number_with_delimiter(12345678, ".") => 12.345.678 def number_with_delimiter(number, delimiter=",", separator=".") begin - parts = number.to_s.split(separator) + parts = number.to_s.split('.') parts[0].gsub!(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1#{delimiter}") parts.join separator rescue |