I'm finding a good way to modeling User different types in the system. For registration, he/she can select to be a student, a mentor, or both. Being a student or a mentor has different set of properties. Student and mentor will have different profile template layout as well.
How wou开发者_运维百科ld you design your controllers and models for this kind of problem?
I would create a
Userwhich can hold aMentorclass and/or aStudentclass. This way your different properties are seperated from each other while the same properties still remain in theUserclass.
In the Controller you can render a template (or partial), depending on the instance the User holds. One for students, one for mentors and one for both.You could also use Inheritance (
Useras parent withMentor,StudentandBothas childs). The key word you want to look into here isSingle Table Inheritance.
Imho the problem is the both option. That's why I would prefer the 1st solution.
加载中,请稍侯......
精彩评论