aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/form_helper_test.rb
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2006-07-18 15:42:22 +0000
committerRick Olson <technoweenie@gmail.com>2006-07-18 15:42:22 +0000
commit101ebc996a241fab4adcbbaf6c8930dddde8d091 (patch)
tree951417ed2e287536b60e6fa37206c4da7964843c /actionpack/test/template/form_helper_test.rb
parent9ac7afcf63efa70a5bf31b642654715eaffe8b90 (diff)
downloadrails-101ebc996a241fab4adcbbaf6c8930dddde8d091.tar.gz
rails-101ebc996a241fab4adcbbaf6c8930dddde8d091.tar.bz2
rails-101ebc996a241fab4adcbbaf6c8930dddde8d091.zip
Allow form_for and fields_for to work with indexed form inputs. [Jeremy Kemper, Matt Lyon]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4613 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/template/form_helper_test.rb')
-rw-r--r--actionpack/test/template/form_helper_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb
index adbfab8881..95d52a30b6 100644
--- a/actionpack/test/template/form_helper_test.rb
+++ b/actionpack/test/template/form_helper_test.rb
@@ -279,6 +279,24 @@ class FormHelperTest < Test::Unit::TestCase
assert_dom_equal expected, _erbout
end
+
+ def test_form_for_with_index
+ _erbout = ''
+
+ form_for("post[]", @post) do |f|
+ _erbout.concat f.text_field(:title)
+ _erbout.concat f.text_area(:body)
+ _erbout.concat f.check_box(:secret)
+ end
+
+ expected =
+ "<form action='http://www.example.com' method='post'>" +
+ "<input name='post[123][title]' size='30' type='text' id='post_title' value='Hello World' />" +
+ "<textarea name='post[123][body]' id='post_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" +
+ "<input name='post[123][secret]' checked='checked' type='checkbox' id='post_secret' value='1' />" +
+ "<input name='post[123][secret]' type='hidden' value='0' />" +
+ "</form>"
+ end
def test_fields_for
_erbout = ''