It's time to put our Rails knowledge to the test. A new litter of puppies has just been born and we need to find them a place to stay until they get adopted by loving parents. We are tasked with placing our pups in animal shelters until that fateful day.
- MVC
- REST
- Request/Response Cycle
- Form/Form Helpers
- ActiveRecord
- Validations
Before you begin, fork and clone this repo, run bundle install and rake db:migrate to get started.
We need a way to keep track of which puppies go into each animal shelter. It looks like another developer has already started building our application. We have models for Puppy and AnimalShelter. But we need a way to association them.
We have several puppies and each animal shelter can potentially as many puppies as is required. Puppies only live at one shelter.
Read through the instructions to get a sense of the scope of this code challenge, and then tackle them one by one.
-
Create the associations between models. You will have to alter the current schema to get your code working. Once you've set up your relationships properly, you will be able to run
rake db:seedwithout errors, and confirm in arails consolethat the puppies and animal shelters have been created with the proper relations. -
On the puppies index page, a puppies's
nameshould link to its show page. -
The puppy show page should include the puppy's name, its weight in pounds (ex: '21 pounds'), and the animal shelter that it currently living in. The animal shelter's name should link to the its show page.
-
On the animal shelter index page, each shelter name should link to its respective show page.
-
The animal shelter show page should have show its name, street address, and state. It should also display all of the puppies that live there.
-
One needs to be able to create a new puppy in the application. A new puppy requires a name, a weight, and the animal shelter it is to be placed.
-
All puppies must have a name and weight, and that weight must be greater_than_or_equal_to 2 pounds.
Do not push your changes up to Github. When you finish:
- If you haven't already, create a custom branch with
git checkout -b custom_branch. git addandgit commityour changes.- From you custom branch, run
git format-patch master --stdout > your_name.patch, replacingyour_namewith your first and last name. - Send the patch file to your instructor on Connect before the specified time. Remember, you can use
open .to launch a Finder window from your current directory, and then drag your file into Connect.