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

Popular posts from this blog

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -