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’,

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

Thank you in advance!!!