collection_select has_many

hi

i have two models: GeoRegion & GeoRegionSub

which have a has_many relation to each other.

how can include the has_many relation in the collection_select helper? i want to have that dropdown where the parent is in black and the children indented.

<%= collection_select :dl,:parent_id, GeoRegion.all.???, :id, :title %>

thx

Same here. It's such a pain to find the appropriate documentation to do that.

u can do that:

<%= select_tag :skillset_id, option_groups_from_collection_for_select(Skillset.find_all_by_parent_id(nil), :children, :title, :id, :title) %>

Skillset is a act_as_tree model!

hope that helps

Thank you.

You just made my day!

I tried your solution then find out this equivalent (better?) grouped_collection_select

Thanks for the help.