Devise with Single Table Inheritance (STI)
Pracuję nad Mongoid i Rails4 Mam taką strukturę modelu (STI), jak ta,
Class User
devise :database_authenticatable, :registerable
end
Klasa użytkownika ma funkcjonalność wymyślną
class Teacher < User
end
class Student < User
end
W route.rb,
devise_for :users
devise_for :teachers, :skip => :sessions
devise_for :students, :skip => :sessions
W kontrolerze student_profile zdefiniowałem,
before_filter :authenticate_student!
Po zalogowaniu się jako „student”, jeśli kliknę ścieżkę student_profiles_path, przekierowanie do pliku root. W bazie danych typ użytkownika zapisuje się jako „type”: „Student”, a podczas rejestracji przekazuję wartość _type przez kolekcję collectionselect.
Czy jest jakieś ustawienie lub kod, które muszę zrobić ... !!!