I am using devise and Pundit in my application. I have many users like Student, Teacher, Admin, Editor. I added a enum role in my User devise model. Now the part i am not understanding is - student will have its own attributes, likewise teachers will have its own attribute. For example student will have school name whereas teacher will have a class. Now if i put everything in user model i will have many null values. How can i use this roles to create a model for each i.e Student, Teacher, Sponsor so i can add those extra attributes own the respective student, teacher , sponsor models. Any help will be appreciated
enum role: [:teacher, :student, :sponsor, :admin]
Expected result: To have a model that has attributes for related to the model itself. Eg. Student will have a column name School in its model instead of User model.
User
model which handles authentication, and associate it with an appropriateStudentProfile
,TeacherProfile
etc model with the required attributes for the given user type – Jon