roles
-id
-role
users
-id
-role_id
schools
-id (primary, foreign-references id on users)
-other attributes
consultancies
-id (primary, foreign-references id on users)
-other attributes
students
-id (primary, foreign-references id on users)
-other attributes
School, Consultancies and Students are specialization (or generalization?) of users.
In their model class, I am trying to establish polymorphic one-to-one relationship. It seems straight forward if there had not been roles table AND then role_id
in user table had been string: role.
But with this structure, how do I get the relationships to work?