Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No need to check html_safe? twice at number_to_percentage #4557

Merged
merged 1 commit into from Jan 20, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions actionpack/CHANGELOG.md
@@ -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
Expand Down
3 changes: 1 addition & 2 deletions actionpack/lib/action_view/helpers/number_helper.rb
Expand Up @@ -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
Expand Down