diff options
author | Rizwan Reza <rizwanreza@gmail.com> | 2010-04-02 14:57:30 +0430 |
---|---|---|
committer | Rizwan Reza <rizwanreza@gmail.com> | 2010-04-02 14:57:30 +0430 |
commit | 0dd3eac967b3dc0225dc4f8b90a3043de54e2fb7 (patch) | |
tree | a3a540e38b1e5f6b36f261ae9b2f0116d1f6e39a /actionpack/lib/action_view | |
parent | 13e3f9c0ce83900d3d5647899a4cff443689c266 (diff) | |
parent | 3adaef8ae73a3061a9fe4c5e0256d80bc09b1cf4 (diff) | |
download | rails-0dd3eac967b3dc0225dc4f8b90a3043de54e2fb7.tar.gz rails-0dd3eac967b3dc0225dc4f8b90a3043de54e2fb7.tar.bz2 rails-0dd3eac967b3dc0225dc4f8b90a3043de54e2fb7.zip |
Merge branch 'master' of git://github.com/rails/rails
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_tag_helper.rb | 4 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/number_helper.rb | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb index ca100e102e..0d47c6eecb 100644 --- a/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -93,6 +93,10 @@ module ActionView # # => <select disabled="disabled" id="destination" name="destination"><option>NYC</option> # # <option>Paris</option><option>Rome</option></select> def select_tag(name, option_tags = nil, options = {}) + if Array === option_tags + ActiveSupport::Deprecation.warn 'Passing an array of option_tags to select_tag implicitly joins them without marking them as HTML-safe. Pass option_tags.join.html_safe instead.', caller + end + html_name = (options[:multiple] == true && !name.to_s.ends_with?("[]")) ? "#{name}[]" : name if blank = options.delete(:include_blank) if blank.kind_of?(String) diff --git a/actionpack/lib/action_view/helpers/number_helper.rb b/actionpack/lib/action_view/helpers/number_helper.rb index 605e5d5873..01fecc0f23 100644 --- a/actionpack/lib/action_view/helpers/number_helper.rb +++ b/actionpack/lib/action_view/helpers/number_helper.rb @@ -273,8 +273,12 @@ module ActionView strip_insignificant_zeros = options.delete :strip_insignificant_zeros if significant and precision > 0 - digits = (Math.log10(number) + 1).floor - rounded_number = BigDecimal.new((number / 10 ** (digits - precision)).to_s).round.to_f * 10 ** (digits - precision) + if number == 0 + digits, rounded_number = 1, 0 + else + digits = (Math.log10(number) + 1).floor + rounded_number = BigDecimal.new((number / 10 ** (digits - precision)).to_s).round.to_f * 10 ** (digits - precision) + end precision = precision - digits precision = precision > 0 ? precision : 0 #don't let it be negative else |