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

android - ConstraintLayout: Realign baseline constraint in case if dependent view visibility was set to GONE -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -

c# - Update a combobox from a presenter (MVP) -