The grouped_options_for_select
method indeed is the correct one.
Since you haven't provided code, this should result in the grouped options you want:
grouped_options_for_select [['Fruits', @fruits.collect {|v| [ v.name, v.id ] }],
['Veggies', @veggies.collect {|v| [ v.name, v.id ] }],
['Junk', @junk_food.collect {|v| [ v.name, v.id ] }]]
Which can be used to create the dropdown:
select_tag 'Food', grouped_options_for_select(...)
or with form_helper:
f.select :food_attribute, grouped_options_for_select(...)