Hello
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
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
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
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment