I can't seem to wrap my mind around Rails associations. Let's say I have 3 tables. One for Users, one for Recipes, and one for Ingredients. Here's an example of the database (in yaml):
Users:
id: 1
email: funnyusername
password: pass1234
Recipes:
id: 1591
user_id: 1
name: Pizza Dough
Ingredients:
id: 1
name: Flour
id: 2
name: Water
id: 3
name: Yeast
Now how would I make it so that a User can have many Recipes, and a Recipe can have many Ingredients. And also be able to find all the Recipes each Ingredient is attached to?
For instance, funnyusername created the Recipe "Pizza Dough" which has the ingredients Flour, Water, and Yeast. Now when I search for Yeast, I would want it to come up with a list of Recipes containing Yeast.