This project is archived and is in readonly mode.
collection_select doesn't honour :index option to fields_for
Reported by David Röthlisberger | May 8th, 2008 @ 05:31 PM
If I do
fields_for :post, @post, :index => 1 do |f|
f.collection_select(:author_name, @posts, :author_name, :author_name)
end
I get
<select name="post[author_name]" ... >
Instead of the expected
<select name="post[1][author_name]" ... >
Without specifying index, it works correctly, i.e.
fields_for 'post[]', @post do |f|
does generate the correct <select name="post[1][author_name]"
The other helpers (text_field, checkbox etc) do work correctly with the :input option.
Comments and changes to this ticket
-
David Röthlisberger May 8th, 2008 @ 05:35 PM
This is on edge rails.
See the test cases in attached 145-001.patch:
the first test (test_collection_select_under_fields_for_with_collection) passes;
the second (test_collection_select_under_fields_for_with_collection) fails.
-
David Röthlisberger May 8th, 2008 @ 05:37 PM
In the previous comment, the second test should be named "test_collection_select_under_fields_for_with_collection_and_index".
-
Pratik July 14th, 2008 @ 04:33 AM
- State changed from new to incomplete
- Tag set to actionpack, bug
Fixed in #518
-
Pratik July 14th, 2008 @ 04:33 AM
- State changed from incomplete to duplicate
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Tags
Referenced by
- 551 Add proper :index support to form helpers #518 and #145