Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #4804 from rafaelfranca/check_box-fix

check_box with nil as unchecked value should be HTML safe
  • Loading branch information...
commit 049dc500b632ca1a05d41a0c5454946f24d15035 2 parents d7a85c5 + ceb1ea6
@josevalim josevalim authored
View
2  actionpack/lib/action_view/helpers/tags/check_box.rb
@@ -25,7 +25,7 @@ def render
add_default_name_and_id(options)
end
- hidden = @unchecked_value ? tag("input", "name" => options["name"], "type" => "hidden", "value" => @unchecked_value, "disabled" => options["disabled"]) : ""
+ hidden = @unchecked_value ? tag("input", "name" => options["name"], "type" => "hidden", "value" => @unchecked_value, "disabled" => options["disabled"]) : "".html_safe
checkbox = tag("input", options)
hidden + checkbox
end
View
4 actionpack/test/template/form_helper_test.rb
@@ -398,6 +398,10 @@ def test_check_box_with_nil_unchecked_value
)
end
+ def test_check_box_with_nil_unchecked_value_is_html_safe
+ assert check_box("post", "secret", {}, "on", nil).html_safe?
+ end
+
def test_check_box_with_multiple_behavior
@post.comment_ids = [2,3]
assert_dom_equal(
Please sign in to comment.
Something went wrong with that request. Please try again.