0

問題があります。私はdeviseでこの認証の問題を解決する方法を理解できません。モデルやSTIで多相関連を使用するかどうかはわかりません。Railsは多くのモデルを持つ場合、STIや多態性を考案していますか?

私にはTeacherとStudentの2つのモデルがあります。そして、私は多形的な関連付けをしようとしています。私は教師と生徒の両方のためのビューファイルを作成している

School::Application.routes.draw do 
    devise_for :users 
    devise_for :teachers 
    devise_for :students 

Teacher model: 
     class Teacher < ActionController::Base 
     has_one :user, :as => :profileable 
     devise :database_authenticatable, :registerable 
     end 
    Student model: 
     class Student < ActionController::Base 
     has_one :user, :as => :profileable 
     devise :database_authenticatable, :registerable 
     end 
    User model: 
     class User < ActionController::Base 
     belongs_to :profileable, :polymorphic => true 
     attr_accessible :email, :password, :password_confirmation, :remember_me 
     end 

マイroutes.rbを:

は、ここに私のモデルです。 しかし、私は1ユーザテーブルとdifferntsビューとsign_upページを持つ方法を理解できません。

2つのサインアップページが必要です。 1人は教師用、もう1人は学生用です。私はUserテーブルにログイン情報(電子メール、パスワード...)を保存したい。

私はこのようなものを作成するにはどうしたらいいですか?

敬具、

Railsは、私はSTIのために行くとスコープビューのセクションを見てモデルごとに異なるビュー用としてなど、ユーザpreferenciesを格納Profileモデルを使用することになり

答えて

2

初心者。