To Examples

Hospital2 Example

Directions

  1. Create a new Rails project named Hospital2.
  2. Generate a Rails model named Doctor with these fields.
    Field Datatype
    name string
    office_num integer
    phone_num string
  3. Generate a Rails model named Patient with these fields.
    Field Datatype
    last_name string
    first_name string
    gender string
    phone_num string
    doctor_id integer
  4. Source code for the seed file Hospital2/db/seeds.rb.
  5. Add the line has_many :patients to the Doctor model.
  6. Add the line belongs_to :doctor to the Patient model.
  7. Generate a controller named ContactInfo with view show:   contact_info.rb   show.html.erb   contact_info.scss
  8. View the show page with this URL:
    http://localhost:3000/contact_info/show