der_tom
(der_tom)
March 16, 2010, 6:03pm
1
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.
der_tom
(der_tom)
March 25, 2010, 8:23pm
3
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
ruby-on-rails
Thanks for the help.