Results 1 to 3 of 3
Thread: User class and subclasses
Oct 4, 2007, 21:59 #1
- Join Date
- Oct 2007
- 0 Post(s)
- 0 Thread(s)
User class and subclasses
My question is part Rails and part database design pattern:
I've got several classes of users in my system:
My thought is to have a base User class for authentication purposes, and instantiate one of the user classes (subclasses of User?) based on the class of the user.
1) is this a smart design pattern for the database? A 'users' table with authentication information and a 'user_class_id' field that points to a 'user_classes' table, from which the proper subclass is instantiated?
if not, what would be the best way to design this?
2) how would you model this in Ruby on Rails? particularly if the user class is in the User table?