tomtt
March 16, 2010, 7:06pm
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
tomtt
March 25, 2010, 6:46pm
2
Same here.
It’s such a pain to find the appropriate documentation to do that.
tomtt
March 25, 2010, 9:25pm
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
tomtt
March 26, 2010, 12:12am
4
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.