Reputation: 891
I am trying to make profiles for employers and employees. Most of the attributes are identical between the two models, but there are a few attributes specific to only employees and a few specific to only employers.
Am I better off creating two tables or is there a better way?
Upvotes: 1
Views: 24
Reputation: 11509
In general, if they represent two distinct entities with different roles and responsibilities in real life, then you should make 2 models.
This will help you keep it clear in your head, and it will also make it easier to define any relations between the two models (or other models) and keep those straight as well. For example, Employee
might have some relation to a Paycheck
model, whereas Employer
would not.
If you want to get fancy, you can create a third model (Human
?) that both Employer
and Employee
inherit from to set up commonalities, but this probably isn't necessary unless you feel strongly that refactoring would improve readability and maintainability.
Upvotes: 1