Rails - Single Table Inheritance or not for Applicant/Employee relationship

前端 未结 1 1468
时光取名叫无心
时光取名叫无心 2021-01-29 03:15

I am am developing a recruitment application for storing records of people who come for an interview. So I have two models - Applicant & Employee which seem like one in OO s

1条回答
  •  伪装坚强ぢ
    2021-01-29 03:43

    As per my personal opinion , in OO point of view you are correct.

    Applicant < Person
    
    Employee < Person
    

    But when it comes to database/ tables i will go for a one table called 'persons' (Person) that has all the columns for both 'Applicant' and 'Employee' and have a column with a flag indicating whether the Person is an Applicant or Employee

    NOTE :: but this is only true if you have ONLY 'several other fields' not many

    HTH

    sameera

    0 讨论(0)
提交回复
热议问题