I’m using Mongoid, Devise and Rails 3.1.
I have four models: Students, Teacher, Parents and School (the main account). All them will log in on system. But, I don’t want create four ways to login. I want create an unique login method using anyone this models, but with respectives roles (This is the minor problem, I already can do that with CanCan).
Anybody have a easy solution, without create a programming-hell?
Actually, people logging on to your system are all
Users. So either you choose to let the classesTeacher, Student, Parent, SchoolRepresentativeto inherit fromUserusing STI.Most of the times I prefer simply that a
Userhasroles. And the role would then beteacher, student ...The
rolesdefine what a user is allowed to see.Hope this helps.