Session 14 Exercises

Exercise 1:


  • Implement an Animal model which contains the name of an animal, the URL of an image of the animal, and a word representation of the sound it makes (meow, woof, etc)

Exercise 2:


  • Create a page at /animals to list all of the animals in your database (bonus points if you find out how to sort them by name!). For each animal, show:
  • The name of the animal
  • The image of the animal

Exercise 3:


  • When clicking on animal, send the ID of the animal to the server via JavaScript using a resource that responds with JSON and open an alert containing the sound the animal makes.