I am using devise for authentication and finding a way to get out of this.
class User < ActiveRecord
belongs_to :loginable, polymorphic: true
end
class Parent < ActiveRecord
has_one :user, as: :loginable
end
class Teacher < ActiveRecord
has_one :user, as: :loginable
end
Can I explore same design having user multiple roles ?. So that he can login as Teacher and Parent both?
Aucun commentaire:
Enregistrer un commentaire