Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix documentation of number_to_currency helper

Now users have to explicit mark the unit as safe if they trust it.

Closes #13161
  • Loading branch information...
commit c82025fcd6f5da92448a1362b38c0a0a9e966a12 1 parent 9c60e3d
@rafaelfranca rafaelfranca authored
View
8 actionpack/lib/action_view/helpers/number_helper.rb
@@ -129,10 +129,10 @@ def number_to_phone(number, options = {})
#
# number_to_currency(-1234567890.50, :negative_format => "(%u%n)")
# # => ($1,234,567,890.50)
- # number_to_currency(1234567890.50, :unit => "£", :separator => ",", :delimiter => "")
- # # => £1234567890,50
- # number_to_currency(1234567890.50, :unit => "£", :separator => ",", :delimiter => "", :format => "%n %u")
- # # => 1234567890,50 £
+ # number_to_currency(1234567890.50, :unit => "R$", :separator => ",", :delimiter => "")
+ # # => R$1234567890,50
+ # number_to_currency(1234567890.50, :unit => "R$", :separator => ",", :delimiter => "", :format => "%n %u")
+ # # => 1234567890,50 R$
def number_to_currency(number, options = {})
return unless number
View
2  actionpack/test/template/number_helper_i18n_test.rb
@@ -53,7 +53,7 @@ def test_number_to_currency_with_clean_i18n_settings
assert_equal("-$10.00", number_to_currency(-10))
end
end
-
+
def test_number_to_currency_without_currency_negative_format
clean_i18n do
I18n.backend.store_translations 'ts', :number => { :currency => { :format => { :unit => '@', :format => '%n %u' } } }
Please sign in to comment.
Something went wrong with that request. Please try again.