Skip to content
This repository
Browse code

No need to check html_safe? twice

  • Loading branch information...
commit 01b4a7c1f4943e9600062de041a4c59c7b0e2ab1 1 parent a2d0b99
Rafael Mendonça França authored January 20, 2012
2  actionpack/CHANGELOG.md
Source Rendered
... ...
@@ -1,5 +1,7 @@
1 1
 ## Rails 4.0.0 (unreleased) ##
2 2
 
  3
+*   Add `:format` option to number_to_percentage *Rodrigo Flores*
  4
+
3 5
 *   Add `config.action_view.logger` to configure logger for ActionView. *Rafael França*
4 6
 
5 7
 *   Deprecated ActionController::Integration in favour of ActionDispatch::Integration
3  actionpack/lib/action_view/helpers/number_helper.rb
@@ -205,8 +205,7 @@ def number_to_percentage(number, options = {})
205 205
           if options[:raise]
206 206
             raise
207 207
           else
208  
-            formatted_number = e.number.to_s.html_safe? ? format.gsub(/%n/, e.number).html_safe : format.gsub(/%n/, e.number)
209  
-            formatted_number.html_safe? ? formatted_number.html_safe : formatted_number
  208
+            e.number.to_s.html_safe? ? format.gsub(/%n/, e.number).html_safe : format.gsub(/%n/, e.number)
210 209
           end
211 210
         end
212 211
       end

0 notes on commit 01b4a7c

Please sign in to comment.
Something went wrong with that request. Please try again.