I have a problem designing the following model. Better I have problems
write the corresponding rails code to get that model up and running as
I tried several combinations of different tables, has_and_belongs_to
statements with several options with join_tables and I tried self joins,
etc… Really, I dont see a solution…
OK, here the problem:
I have the model “Item” and every “Item” should be craftable. Therefore
needs “Ingredients”, this “Ingridients” are “Items” too.
Given Item “Flour”
And Item “Water”
When I mix it
Then I should have the Item “Dough”
But it is not that easy (the above example is complicated enough for
Since the Items have all a unit of messurement (Water is litre, Flour is
kilograms) I only want to have fractions in the receipe list.
Something like that:
1kg Flour + 0.25 litre Water = 1.25 kg Dough
I really dont know how to do the migration and model for that “Recipe”
Of course there are Items that dont have ingredients (How could I
something into water?) or are not needed as Ingredient anymore (What
I build with a skyscraper?)
Could you help me?