This project is archived and is in readonly mode.
Allow strings to be sent as collection to select
Reported by José Valim | April 1st, 2009 @ 11:55 AM | in 2.x
Why?
The main reason is to allow the following:
fields_for @post do |f|
f.select(:category_id, grouped_options_for_select(...))
end
Since grouped_options_for_select returns a string, prior to this patch this wouldn't work. We would have to use select_tag method, which is not very friendly since it does not generate names properly and does not work with nested attributes as well (it wouldn't generate blog[post][0][category], unless explicitly given).
Comments and changes to this ticket
-
Michael Koziarski April 5th, 2009 @ 10:09 AM
- Assigned user set to Eloy Duran
Does this look ok to you eloy?
Is there more we could do to make the nested form helpers work nicely with select and collection_select?
-
Eloy Duran April 7th, 2009 @ 10:00 PM
- State changed from new to verified
The patch does what the ticket says. +1
If there's more that could be done or isn't working please report. Otherwise I'll inspect this the next time I have to work in this area.
-
José Valim April 7th, 2009 @ 10:18 PM
Thanks Eloy! You would like to check #2392 as well, it's related with the :index option.
-
Matt Jones May 14th, 2009 @ 08:17 PM
You might also want to take a look at #1986, which allows options_for_select (used by select) to handle optgroups as well.
-
Repository May 15th, 2009 @ 04:31 AM
- State changed from verified to committed
(from [66ead4f148964ad7af33f5e44e79fa50a7a00f61]) Allow strings to be sent as collection to select.
Signed-off-by: Michael Koziarski michael@koziarski.com
[#2391 state:committed] http://github.com/rails/rails/commit/66ead4f148964ad7af33f5e44e79fa...
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
- 2391 Allow strings to be sent as collection to select Signed-off-by: Michael Koziarski michael@koziarski.com [#...