0

I would like to create a new app rails but being a beginner it's been several days that I try several possible ways without really finding the right one, I just managed to do something but I'm not sure that it's perfect in terms of relationships. the concept would be that people could either create or participate in meals. I would like the ingredients to be reusable, but their attributes such as the origin or cooking method can be modified in each case. do you think this style of rallying is fair?

enter image description here

or

enter image description here

1 Answer 1

1

The second option is a classic one. Stick to using many-to-many relation in that cases. Though it is better to have one-to-many relation between specification and menu - like several specifications for each menu. And specification should also contain ingredient_id.

Sign up to request clarification or add additional context in comments.

3 Comments

All right, I'll try to implement that, thank you very much.
@JeanClaudeLemens. I just though, that you can actually use Specifications as a middle table for ingredients-menu many-to-many relation. So, one menu may have many specifications. Each specification have one menu id and one ingredient id. So you will not need the ingredients_list table.
You mean like the first example?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.