From 63f48b113a31c8ef523293ff6d9bc8c5c2261aef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Wed, 4 Jan 2012 03:01:23 -0300 Subject: [PATCH 1/4] No need of html_safe here tag helper always return a html safe string and concat two html safe strings always return a html safe string --- actionpack/lib/action_view/helpers/form_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index d46ee4faef..1e4bebeee7 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -1093,7 +1093,7 @@ def to_check_box_tag(options = {}, checked_value = "1", unchecked_value = "0") end hidden = tag("input", "name" => options["name"], "type" => "hidden", "value" => options['disabled'] && checked ? checked_value : unchecked_value) checkbox = tag("input", options) - (hidden + checkbox).html_safe + hidden + checkbox end def to_boolean_select_tag(options = {}) From 73a0f9df475159bf7f5f4df60d5b8f2694407d8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Wed, 4 Jan 2012 12:37:20 -0300 Subject: [PATCH 2/4] Add test to make sure that add two safe buffers always return a safe buffer --- activesupport/test/safe_buffer_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/activesupport/test/safe_buffer_test.rb b/activesupport/test/safe_buffer_test.rb index 8f77999d25..c7a4c9f7e8 100644 --- a/activesupport/test/safe_buffer_test.rb +++ b/activesupport/test/safe_buffer_test.rb @@ -96,6 +96,13 @@ def setup assert !@buffer.dup.html_safe? end + test "Should return safe buffer when added with another safe buffer" do + clean = "