diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-02-18 16:00:47 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-02-18 16:00:47 -0300 |
commit | 1879c259b870938c42d5d52f63123bfa0b8c81c8 (patch) | |
tree | fb11dc4b5ca6bb20092631afa02c9cb392ddb80c /actionview/lib | |
parent | 4f23760a07186ff9c0c5935c971d2978f9f57277 (diff) | |
parent | 8b20c72dd80e2faf531f308d430a145a253aeac3 (diff) | |
download | rails-1879c259b870938c42d5d52f63123bfa0b8c81c8.tar.gz rails-1879c259b870938c42d5d52f63123bfa0b8c81c8.tar.bz2 rails-1879c259b870938c42d5d52f63123bfa0b8c81c8.zip |
Merge branch '4-1-0-beta2'
Conflicts:
actionview/CHANGELOG.md
activerecord/CHANGELOG.md
Diffstat (limited to 'actionview/lib')
-rw-r--r-- | actionview/lib/action_view/helpers/number_helper.rb | 19 | ||||
-rw-r--r-- | actionview/lib/action_view/version.rb | 2 |
2 files changed, 15 insertions, 6 deletions
diff --git a/actionview/lib/action_view/helpers/number_helper.rb b/actionview/lib/action_view/helpers/number_helper.rb index ad825cd1f1..7157a95146 100644 --- a/actionview/lib/action_view/helpers/number_helper.rb +++ b/actionview/lib/action_view/helpers/number_helper.rb @@ -384,20 +384,29 @@ module ActionView def delegate_number_helper_method(method, number, options) return unless number - options = escape_unsafe_delimiters_and_separators(options.symbolize_keys) + options = escape_unsafe_options(options.symbolize_keys) wrap_with_output_safety_handling(number, options.delete(:raise)) { ActiveSupport::NumberHelper.public_send(method, number, options) } end - def escape_unsafe_delimiters_and_separators(options) - options[:separator] = ERB::Util.html_escape(options[:separator]) if options[:separator] && !options[:separator].html_safe? - options[:delimiter] = ERB::Util.html_escape(options[:delimiter]) if options[:delimiter] && !options[:delimiter].html_safe? - options[:unit] = ERB::Util.html_escape(options[:unit]) if options[:unit] && !options[:unit].html_safe? + def escape_unsafe_options(options) + options[:format] = ERB::Util.html_escape(options[:format]) if options[:format] + options[:negative_format] = ERB::Util.html_escape(options[:negative_format]) if options[:negative_format] + options[:separator] = ERB::Util.html_escape(options[:separator]) if options[:separator] + options[:delimiter] = ERB::Util.html_escape(options[:delimiter]) if options[:delimiter] + options[:unit] = ERB::Util.html_escape(options[:unit]) if options[:unit] && !options[:unit].html_safe? + options[:units] = escape_units(options[:units]) if options[:units] && Hash === options[:units] options end + def escape_units(units) + Hash[units.map do |k, v| + [k, ERB::Util.html_escape(v)] + end] + end + def wrap_with_output_safety_handling(number, raise_on_invalid, &block) valid_float = valid_float?(number) raise InvalidNumberError, number if raise_on_invalid && !valid_float diff --git a/actionview/lib/action_view/version.rb b/actionview/lib/action_view/version.rb index edb6d8f116..3d5d6c9be1 100644 --- a/actionview/lib/action_view/version.rb +++ b/actionview/lib/action_view/version.rb @@ -1,7 +1,7 @@ module ActionView # Returns the version of the currently loaded ActionView as a Gem::Version def self.version - Gem::Version.new "4.1.0.beta1" + Gem::Version.new "4.1.0.beta2" end module VERSION #:nodoc: |