This project is archived and is in readonly mode.

#2391 ✓committed
José Valim

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

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>

Attachments

Referenced by

Pages