I'm creating a inventory management app in rails. I have an User Table and a Recipe table, there is also some tables with types of material (pens, sharpies, paper, and so on). Because there is a lot of types of paper, pens and other things, and every user may want a diferent pen, but a pen I think that it will be better to have a type of article and have in the Recipe table the Quantity of articles needed. So when an user checks his list of articles there will be Pens: 2 and maybe some options and a search for more info of an specific pen. Like a ToDo list. But I having trouble to figure out the relationships of the tables for this purpose. Right now im designing the database. I was thinking in use MySQL in Rails.


Try to put 'on paper' what you 'fields' that you need. Once you have that then you must group them based on what fields have a same identifier. In you case you might have 3 entities:

  1. User with an ID and a name
  2. Group with an ID and a name (with values like like pen and paper)
  3. Material with an ID, the GroupID and a name

For the ToDo you can try yourself to figure it out.

Google on database normalisation to find some more information. You do not need to go down all the way but try to figure out the first 3 forms.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.