Permalink
Browse files

add :remote option to form_tag

  • Loading branch information...
1 parent a3349f8 commit a9e89e82b67f721fe68ca58a2d371b666cdb7441 @stevestmartin stevestmartin committed with josh Jan 31, 2010
@@ -441,6 +441,7 @@ def html_options_for_form(url_for_options, options, *parameters_for_url)
returning options.stringify_keys do |html_options|
html_options["enctype"] = "multipart/form-data" if html_options.delete("multipart")
html_options["action"] = url_for(url_for_options, *parameters_for_url)
+ html_options["data-remote"] = true if html_options.delete("remote")
end
end
@@ -53,6 +53,12 @@ def test_form_tag_with_method_delete
assert_dom_equal expected, actual
end
+ def test_form_tag_with_remote
+ actual = form_tag({}, :remote => true)
+ expected = %(<form action="http://www.example.com" method="post" data-remote="true">)
+ assert_dom_equal expected, actual
+ end
+
def test_form_tag_with_block_in_erb
__in_erb_template = ''
form_tag("http://example.com") { concat "Hello world!" }

0 comments on commit a9e89e8

Please sign in to comment.