jeudi 14 mai 2015

Object with more than one Model (Rails)

BACKGROUND: I'm thinking conceptually about how to reference a single object that can belong to more than one model. For instance, if I have a School and Employer model - a User could theoretically have attended and be employed at the same School. Ideally both relationships to point to the same object.

QUESTION: How would I model that in a postgresql-based Rails app?

UPDATE In this case, I'd need a user to be able to have both one or more Schools and one or more Employers.

Aucun commentaire:

Enregistrer un commentaire