From 3859828d89d378986af0fc2390608b00aad5e912 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Wed, 31 Mar 2010 19:49:29 -0700 Subject: HTML safety: give a deprecation warning if an array of option tags is passed to select tag. Be sure to join the tag yourself and mark them .html_safe --- actionpack/lib/action_view/helpers/form_tag_helper.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'actionpack/lib') 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 # # => 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) -- cgit v1.2.3 From 81e69332466003732846bd7dbc04e8550bfe16a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernardo=20de=20P=C3=A1dua?= Date: Thu, 1 Apr 2010 01:19:09 -0300 Subject: Fix error in number_with_precision with :significant option and zero value [#4306 state:resolved] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- actionpack/lib/action_view/helpers/number_helper.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'actionpack/lib') 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 -- cgit v1.2.3 From d868cb4f8a84b6275b6407b20bb3ba939a53681a Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 1 Apr 2010 13:36:45 -0700 Subject: Prep for beta2, depend on latest Bundler --- actionpack/lib/action_pack/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_pack/version.rb b/actionpack/lib/action_pack/version.rb index 72a1cd30ad..0b40465a79 100644 --- a/actionpack/lib/action_pack/version.rb +++ b/actionpack/lib/action_pack/version.rb @@ -3,7 +3,7 @@ module ActionPack MAJOR = 3 MINOR = 0 TINY = 0 - BUILD = "beta1" + BUILD = "beta2" STRING = [MAJOR, MINOR, TINY, BUILD].join('.') end -- cgit v1.2.3 From dc5300adb6d46252c26e239ac67e3ca6e5e2d77b Mon Sep 17 00:00:00 2001 From: Paul Sadauskas Date: Mon, 8 Feb 2010 11:08:31 -0700 Subject: Slightly less annoying check for acceptable mime_types. This allows Accept: application/json, application/jsonp (and the like), but still blacklists browsers. Essentially, we use normal content negotiation unless you include */* in your list, in which case we assume you're a browser and send HTML [#3541 state:resolved] --- actionpack/lib/action_dispatch/http/mime_negotiation.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_dispatch/http/mime_negotiation.rb b/actionpack/lib/action_dispatch/http/mime_negotiation.rb index be89924015..4082770b85 100644 --- a/actionpack/lib/action_dispatch/http/mime_negotiation.rb +++ b/actionpack/lib/action_dispatch/http/mime_negotiation.rb @@ -48,7 +48,7 @@ module ActionDispatch @env["action_dispatch.request.formats"] ||= if parameters[:format] Array(Mime[parameters[:format]]) - elsif xhr? || (accept && !accept.include?(?,)) + elsif xhr? || (accept && accept !~ /,\s*\*\/\*/) accepts else [Mime::HTML] @@ -87,4 +87,4 @@ module ActionDispatch end end end -end \ No newline at end of file +end -- cgit v1.2.3