ruby on rails 5 - has_many and has_one, any advantages/disadvantages? -
this general question. lets assume have following situation: have patient (many) , doctor (few) model. want each patient related 1 doctor. can 2 ways, either doctor has_many patients or patient has_one doctor. using 1 or has dis-/advantages or irrelevant 1 use?
it sounds more want have many many relationship, otherwise won't have history between doctor , patient if patient changes doctors. make 3rd table, add foreign key both patient , doctor.
Comments
Post a Comment