Permalink
Browse files

Merge pull request #4557 from rafaelfranca/av-number_helper-refactor

No need to check html_safe? twice at number_to_percentage
  • Loading branch information...
2 parents 79f7bbb + 01b4a7c commit 712b0b99a273c49fb4fad48ae61b4ce252ec0562 @josevalim josevalim committed Jan 20, 2012
Showing with 3 additions and 2 deletions.
  1. +2 −0 actionpack/CHANGELOG.md
  2. +1 −2 actionpack/lib/action_view/helpers/number_helper.rb
View
@@ -1,5 +1,7 @@
## Rails 4.0.0 (unreleased) ##
+* Add `:format` option to number_to_percentage *Rodrigo Flores*
+
* Add `config.action_view.logger` to configure logger for ActionView. *Rafael França*
* Deprecated ActionController::Integration in favour of ActionDispatch::Integration
@@ -205,8 +205,7 @@ def number_to_percentage(number, options = {})
if options[:raise]
raise
else
- formatted_number = e.number.to_s.html_safe? ? format.gsub(/%n/, e.number).html_safe : format.gsub(/%n/, e.number)
- formatted_number.html_safe? ? formatted_number.html_safe : formatted_number
+ e.number.to_s.html_safe? ? format.gsub(/%n/, e.number).html_safe : format.gsub(/%n/, e.number)
end
end
end

0 comments on commit 712b0b9

Please sign in to comment.