A hospital has physicians and patients. A physician has many patients. A patient has many physicians. They two parties meet via appointments. Appointments have a date, time, location, patient, and physician.
Patient needs: Do I have any physician appointments? When, where, & with whom?
Physician needs: Do I have any appointments today? Show me each appointment location, time, and name of each patient.
In your shell…
Go to your models and make ‘em look like this…
Open up your controllers, scroll down to the bottom and check out your strong parameters. Physician and Patient are only allowed to write :title. Look at the appointments_controller. Note the :physician_id and the :patient_id.
Migrate your database
and make some data in the console.
Appointments establish the association with the physician_id and patient_id. Check out the ids.
Bob wants to make an appointment with Dr. Cindy at the hospital today.
And where done! Here are a few ways to check out your data in the console.