Skip to content

Commit

Permalink
button_to should generate an html_safe string
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Koziarski <michael@koziarski.com>
  • Loading branch information
nono authored and NZKoz committed Mar 22, 2010
1 parent c0137f6 commit 26f2cce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions actionpack/lib/action_view/helpers/url_helper.rb
Expand Up @@ -308,8 +308,8 @@ def button_to(name, options = {}, html_options = {})

html_options.merge!("type" => "submit", "value" => name)

"<form method=\"#{form_method}\" action=\"#{escape_once url}\" class=\"button-to\"><div>" +
method_tag + tag("input", html_options) + request_token_tag + "</div></form>".html_safe
("<form method=\"#{form_method}\" action=\"#{escape_once url}\" class=\"button-to\"><div>" +
method_tag + tag("input", html_options) + request_token_tag + "</div></form>").html_safe
end


Expand Down
4 changes: 4 additions & 0 deletions actionpack/test/template/url_helper_test.rb
Expand Up @@ -88,6 +88,10 @@ def test_button_to_with_method_get
)
end

def test_button_to_returns_an_html_safe_string
assert button_to("Hello", "http://www.example.com").html_safe?
end

def test_link_tag_with_straight_url
assert_dom_equal "<a href=\"http://www.example.com\">Hello</a>", link_to("Hello", "http://www.example.com")
end
Expand Down

0 comments on commit 26f2cce

Please sign in to comment.