# Dynamic drop down - pls do help

**URL:** <https://www.ruby-forum.com/t/dynamic-drop-down-pls-do-help/105464>\
**Category:** Rails\
**Created:** [May 30, 2007, 8:48am UTC](https://www.ruby-forum.com/t/dynamic-drop-down-pls-do-help/105464 "2007-05-30T08:48:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anusha18](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3d9bf3/32.png) [@anusha18](https://www.ruby-forum.com/u/anusha18)\
**Post date:** [May 30, 2007, 8:48am UTC](https://www.ruby-forum.com/t/dynamic-drop-down-pls-do-help/105464/1 "2007-05-30T08:48:17Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![anusha18](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/3d9bf3/32.png) [@anusha18](https://www.ruby-forum.com/u/anusha18)\
**Post date:** [May 30, 2007, 4:36pm UTC](https://www.ruby-forum.com/t/dynamic-drop-down-pls-do-help/105464/2 "2007-05-30T16:36:15Z")

</div>

You could have a look at acts\_as\_tree to build up a hierarchy of options  
using a single model  
[http://wiki.rubyonrails.org/rails/pages/ActsAsTree](http://wiki.rubyonrails.org/rails/pages/ActsAsTree)

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.

Cheers,  
James
