Dynamic select(so annoying)

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!!!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs