Answer the question
In order to leave comments, you need to log in
Do I need to store calories, fats, carbs, and proteins separately for recipe and ingredient?
I have a program that calculates the calorie content of recipes that the user has chosen and then calculates the calorie content of all recipes.
What is the best way to organize the recipe and ingredient models so that the fields are not duplicated?
Perhaps some kind of interface is needed?
Answer the question
In order to leave comments, you need to log in
Heh, I did this myself.
Removed from the recipe everything related to the attributes of the resulting product and added a field of type result_product_id, in which the result is stored. (although then it will not be possible to make the recipe for cabbage rolls and "lazy cabbage rolls" lead to the same result, although from a certain point of view it is ok)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question