Suppose there is an activerecord class called a user, which is a representative of the database user table.
But I have different types of users who have
- special functions
- special variables
- user relations (employer has_many company, Employee belongs to the company :)
But these users also have a lot in common. Therefore, I want to create classes for each type of user, and then inherit them from the user class.
- User <ActiveRecord :: Base
- Employer <User
- Employee <User
- Client <User
What is the best way to do something like this?
thank
source
share