Watchman (Database)

Readme Homework


Episode3: Watchman -- Datastores in YML and Postgres

Storing data in Postgres, with migrations, outside of Rails

Your Assignment

  1. Download and install PostgreSQL (see show notes)
  2. Clone, fork this repo and copy the config/database.yml.sample to config/database.yml, edit with values

Panda Level

  1. Add 2 more TV shows to the seeds file
  2. When I run ruby watchman.rb, Have it output all TV shows

Tiger Level

  1. Ask the user what day they want to watch shows?
  2. Output only the shows matching that day of the week

Eagle (Advanced) Level

  1. Create a table (using the migrations) which represents a hobby of yours: Fishing, Sports, Cooking, etc.
  2. When I run ruby watchman.rb
    • Fill the table with 5 records (Recipe.create)
    • Have it show me all the records, with a nicely implemented to_s method
    • Ask me (the user) what I want to show. Example, if you have Recipe with :name and :ingredients:
[Recipes.all]
"Cornbread Muffins", [corn, butter, oil]
"Tacos", [tortilla, avacado, shrimp]

What would you like to learn more about?

#[editor: if I enter "Tacos" I'll see the Tacos recipe. If I enter nutella, I see "sorry Dave, I can't do that right now"]

Show Notes

Copyright: Jesse Wolgamott, MIT License (See LICENSE)

Watchman (Database)

  • Area:

    Databases  
  • Runtime:

    51  
  • Tech:

    Postgres  
  • Tags:

    postgres activerecord  

Episode 3 gets you to install Postgres and start making database calls and tests using a database.

Notes:
* If you don't already have postgres installed, but are on a mac, you already have Postgres installed
* to uninstall postgres before re-installing, try the answers here: http://stackoverflow.com/questions/2715055/how-to-uninstall-postgresql-on-my-mac-running-snow-leopard and http://forums.enterprisedb.com/posts/list/1744.page
* It's normal if you have troubles with the DB setup.

Accessing the database is a big part of applications! I hope you enjoy this one, and if you have trouble: please ask!

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

ABOUT RUBY OFF RAILS

Ruby Off Rails is dedicated to accelerating the mastering of Ruby and increasing developer happiness everywhere.

In my software training, I see two distinct sets of programmers: those who know Ruby, and those who haven’t learned it yet. People who learn Ruby have an easier time understanding Rails, gems, and what magic voodoo is going on. And most importantly, they can cast wicked voodoo themselves.