角色
-id
-role
用户
-id
-role_id
学校
-id (primary, foreign-references id on users)
-other attributes
咨询
-id (primary, foreign-references id on users)
-other attributes
生
-id (primary, foreign-references id on users)
-other attributes
学校,咨询和学生是用户的专业化(或概括?)。
在他们的模型类中,我试图建立多态一对一的关系。如果没有角色表,那么看起来很简单,然后用户表中的role_id
已经是string:role。
但是通过这种结构,我如何让关系发挥作用?