[Rails] [RAILS] How to design that Model?
Hi!
I have a problem designing the following model. Better I have problems to write the corresponding rails code to get that model up and running as expected.
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 it 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 me).
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 assemble something into water?) or are not needed as Ingredient anymore (What should I build with a skyscraper?)
Could you help me?
TIA
Norbert Melzer
-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/tWLjzi_50BQJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home