a rails newbie here, looking at doing some work with 4 tables and not totally sure how to structure the associations. Below topic involves real estate, probably helpful to keep that in mind.
I have four models: Property - a physical house Project - a large group of jobs happening at a house Job - a specific job at a house Worker - a person doing the work
The associations as I see them in my head are: - a Property can have many Projects, Jobs, and Workers - a single Project belongs to one Property, but can have many Jobs and (via Jobs) have many Workers - a single Job belongs to one Project and to one Property (via the Project), but can have many Workers - a single Worker can have one Job on one Projects on one Property
My two questions are:
1) What is the best way to think about the above set of relationships?
**2) How do I build the associations between my models? Can't get my head wrapped around how to do that.
Really appreciate any thoughts!
Aucun commentaire:
Enregistrer un commentaire