Rails devise STI or polymorphic, when having many models?


I have a problem. I cant figure out how to solve this authentication
problem with devise and i dont know if i should use a polymorphic
association in the models or STI.

I have 2 models like Teacher and Student. And i am trying to make a
polymorphic association.

Here is my models:

   Teacher model:
        class Virksomhed < ActionController::Base
        has_one :user, :as => :profileable
        devise :database_authenticatable, :registerable
    Student model:
        class Student < ActionController::Base
        has_one :user, :as => :profileable
        devise :database_authenticatable, :registerable
    User model:
        class User < ActionController::Base
        belongs_to :profileable, :polymorphic => true

attr_accessible :email, :password, :password_confirmation, :remember_me

My routes.rb

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

I have created the views files for both Teachers and Students. But i
cant figure out how to have 1 user table and differnts views and
sign_up pages.

I want to have 2 sign up pages. One for Teacher and one for Student. I
want the User table to store the login information(email,
password ...).

How do I create such a thing with devise?

Best regards,

Rails beginner

In that case, you want to use STI.

To get that working, your user class would inherit from ActiveRecord::Base, but your Student and Teacher class would inherit from User. No associations necessary.

class User < ActiveRecord::Base
class Student < User
class Teacher < User