Giter Site home page Giter Site logo

ldgarber / displaying-has-many-through-rails-lab-v-000 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from learn-co-students/displaying-has-many-through-rails-lab-v-000

0.0 2.0 0.0 108 KB

License: Other

Ruby 83.23% JavaScript 1.60% CSS 1.66% HTML 13.51%

displaying-has-many-through-rails-lab-v-000's Introduction

Displaying Has Many Through Rails Lab

Objectives

  1. Construct a bi-directional has many through.
  2. Query for associations via the belongs_to, has_many, and has_many through associations.
  3. Iterate over associations in a view and display associated data for a primary instance.
  4. Identify the join model in a has many through.

Overview

The poor doctors at Seattle Grace Hospital are so overworked, they're having trouble keeping track of their patients appointments! Let's help them (and practice our associations) by building some associations and displaying the data.

greys-anatomy

Instructions

First, fork and clone this lab. Before anything, note that when you generate models, controllers, etc, be sure to include this option, so that it skips tests (which we already have): --no-test-framework

You'll need to create all of the migrations, models, routes, controllers, and views for this lab.

  1. Create migrations and models for doctor, patient, and appointment. Because this is for a hospital, a doctor can have many patients, but a patient also has many doctors. Patients and doctors both have many appointments. Our appointments table should have a column called appointment_datetime to represent the date and time the appointment will take place. ( When you display this datetime, make sure it's in a human readable format. The tests will be expecting "January 12, 2016 at 3:00")

  2. Create a Doctor's index page which displays each doctor's name, a link to their show page, and a count of their patients.

  3. Create a Doctor's show page which displays the doctor's name, department, and each appointments date, time, patient name and a link to that patient's show page.

  4. Create a Patient's show page which lists each appointments date and time and a link to the corresponding doctor's show page.

  5. Create a Patient's index page which displays a link to each patient's show page and the total number of appointments they have.

  6. Create an appointment's show page which shows the date, time, patient and doctor for that particular appointment. Note that there should NOT be an appointments index page - we don't want to have all of the appointments on display here.

We've provided a seeds file so you can have some data to play around with - run rake db:seed once your migrations and models are complete.

View Displaying Has Many Through Rails Lab on Learn.co and start learning to code for free.

View Displaying Has Many Through Lab on Learn.co and start learning to code for free.

displaying-has-many-through-rails-lab-v-000's People

Contributors

ipc103 avatar pletcher avatar aviflombaum avatar annjohn avatar blake41 avatar kwebster2 avatar ldgarber avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.