Create a select tag with some options grouped and others not grouped

Posted by dontangg on Stack Overflow See other posts from Stack Overflow or by dontangg
Published on 2011-01-02T05:44:39Z Indexed on 2011/01/02 5:54 UTC
Read the original article Hit count: 200

I'm using Rails 3. I want to create a select tag with some options grouped and others not grouped. Options would look something like this:

Income Auto Fuel Maintenance Home Maintenance Mortgage

In this example, Income is not a group, but Auto and Home are.

I see three helper methods grouped_options_for_select and grouped_collection_select, option_groups_from_collection_for_select.

Is there a way to use a helper to do this or will I have to generate the HTML myself? I imagine I could use two different helpers to create the options and just append the results of both.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby-on-rails3