# Dynamic select(so annoying)

**URL:** <https://www.ruby-forum.com/t/dynamic-select-so-annoying/192571>\
**Category:** Rails\
**Created:** [August 2, 2010, 12:46pm UTC](https://www.ruby-forum.com/t/dynamic-select-so-annoying/192571 "2010-08-02T12:46:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fujianloverails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/ecccb3/32.png) [@fujianloverails](https://www.ruby-forum.com/u/fujianloverails)\
**Post date:** [August 2, 2010, 12:46pm UTC](https://www.ruby-forum.com/t/dynamic-select-so-annoying/192571/1 "2010-08-02T12:46:11Z")

</div>

Hi, guys,  
I am a rookie in rails, I’d like to make two dynamic selects connecting  
with the database:  
in select 1 I have some countries(US,CA,UK)  
and I already built a table in my database called food:  
id food\_name food\_country

the items of select 1 are retrieved from table

when selecting a particular item in select 1, select 2 could dynamically  
change the items it contained(for example, US =\> ‘hamburger’,  
‘chips’,…)

furthermore, the two selects are part of one form, when it’s submitted,  
something else like a table or chart will be showed besides the form.

I have already read some materials but still struggling in countless  
trials, I am frustrated by the concepts of render and collect\_select(I  
know little about ajax) and actions interacted in the process, would you  
like to give me a detailed explanation of the structure to meet with my  
requirement?

Thank you in advance!!!
