diff options
author | Vasiliy Ermolovich <younash@gmail.com> | 2014-04-13 21:58:42 +0300 |
---|---|---|
committer | Vasiliy Ermolovich <younash@gmail.com> | 2014-04-14 17:13:43 +0300 |
commit | 3964bbc490bdd858b431862bdefa58f477cb2028 (patch) | |
tree | 25f3ce6c7f947642e587cd5d68d408548ff3f8fd /actionview/test | |
parent | 0bccde963c0b3e2ad65b2bdac9d144f40854ec90 (diff) | |
download | rails-3964bbc490bdd858b431862bdefa58f477cb2028.tar.gz rails-3964bbc490bdd858b431862bdefa58f477cb2028.tar.bz2 rails-3964bbc490bdd858b431862bdefa58f477cb2028.zip |
`collection_check_boxes` respects `:index` option for the hidden filed name.
closes #14147
Diffstat (limited to 'actionview/test')
-rw-r--r-- | actionview/test/template/form_collections_helper_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/actionview/test/template/form_collections_helper_test.rb b/actionview/test/template/form_collections_helper_test.rb index 8107529149..5e991d87ad 100644 --- a/actionview/test/template/form_collections_helper_test.rb +++ b/actionview/test/template/form_collections_helper_test.rb @@ -221,6 +221,13 @@ class FormCollectionsHelperTest < ActionView::TestCase assert_select "input[type=hidden][name='user[other_category_ids][]'][value=]", :count => 1 end + test 'collection check boxes generates a hidden field with index if it was provided' do + collection = [Category.new(1, 'Category 1'), Category.new(2, 'Category 2')] + with_collection_check_boxes :user, :category_ids, collection, :id, :name, { index: 322 } + + assert_select "input[type=hidden][name='user[322][category_ids][]'][value=]", count: 1 + end + test 'collection check boxes does not generate a hidden field if include_hidden option is false' do collection = [Category.new(1, 'Category 1'), Category.new(2, 'Category 2')] with_collection_check_boxes :user, :category_ids, collection, :id, :name, include_hidden: false |