Session 15 Exercises:

Exercise 1:


  • Create a GuestBook model that has a name
  • Create a GuestBookEntry model that has a guest_book_id, person_name, and body

Exercise 2:


  • Create a page (index) that lists all of the guest books
  • Create a page (show) which allows you to see the messages in an individual guest book

Exercise 3:


  • Move the list of messages into a separate action and refresh it every 3 seconds via JavaScript
  • Instead of the page reloading, only reload the list of messages
  • TIP: Check out setInterval
  • NOTE: This should mean when you create a message in the console, it updates automatically.

Exercise 4 (Bonus):


  • Implement a form that allows you to add a new entry to a guest book in a separate browser.
  • NOTE: When you add the guest book entry, it should refresh the list automatically in BOTH browsers.