Forum: Ruby on Rails dynamic drop down - pls do help

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Anusha s. (Guest)
on 2007-05-30 10:48
how to create dynamic drop down using a single model...
like one drop down list should have list of states which should be
populated by taking the values from the database.... and depending on
the selection of option in the first drop down list the values in the
second(cities) drop down list should be populated taking the values from
the database...
it wud be grateful if any one can come forward and help me do dat ....
i cud do that but using 2 models....
James Brooks (Guest)
on 2007-05-30 18:36
(Received via mailing list)
You could have a look at acts_as_tree to build up a hierarchy of options
using a single model

So you could have first options: A and B
and as children of A have: C and D
and as children of B have: E and F

You can scale this to as many levels as you like.

This topic is locked and can not be replied to.