Homework for 8B

Review

Topics Covered: Databases, Active Record, Schema, Migrations, Seeds

Exercise

Note: All exercises must live inside of your session0202_exercises/firstname_lastname/d8 folder

While inside of your session0202_exercises directory, you can git add . then git commit -m "Helpful commit message here" and git push origin master to submit your homework to GitHub. (Don't forget to use git status along the way to check the state of your files in git)

Tip: Keep a terminal tab with session0202_exercises open so you can add and commit your app each time you make substantial changes

Lekker Plekke

Our cool places app, Lekker Plekke, will allow us to keep track of and share all of the cool places we find in Cape Town.

So many places to go and so little time! Let's get started!

Rails App

  1. Create a new rails app called lekker_plekke.
  2. Typically at this point we would initialize git, but since we're working inside of our d8 folder, simply cd .. back out to your session0202_exercises folder to add and commit your files with git.

Place Model

  1. Generate a Place model. What attributes do you think your Place model will need? Try to think of at least two useful attributes (hint: name might be useful!).
  2. Use seeds.rb (or the rails console) to seed your database with a few cool places in Cape Town that you've seen so far!

Places Controller & Routes

  1. Create a places controller, with the following methods: index and show
  2. Create appropriate views for index and show.
    • On the index page, list all places by name.
    • On the show page, display an individual place, including all attributes.
  3. Create corresponding routes for all of your views/actions

Challenge

  1. Add create, new, edit, update and destroy actions to your places controller.
  2. Add appropriate views for creating and editing places. (hint: having forms will help)
  3. Add a show link to each place listed on the index page.
  4. Add edit and destroy links to each place listed on the index page.

Optional: BONUS (Advanced)

Add functionality for liking and commenting on different places.

Optional: EXTRA BONUS

Make your app look good by using the twitter bootstrap gem!

Example Lekker Plekke

P.S. This includes the bonus and extra bonus! If your app doesn't look exactly like this, don't panic. As long as the content for the index and the show pages are there, you're all set.

Great work! Now add and commit your work then push it to GitHub :)

Remember, your .git folder is located inside of the session0202_exercises folder, not inside of your lekker_plekke folder