Skip to content

Instantly share code, notes, and snippets.

@vanderhoop
Last active August 29, 2015 14:13
Show Gist options
  • Select an option

  • Save vanderhoop/c6bfb3f1cb87ff41bdfd to your computer and use it in GitHub Desktop.

Select an option

Save vanderhoop/c6bfb3f1cb87ff41bdfd to your computer and use it in GitHub Desktop.

The Diary That Also Acts as a Sketchbook

You just persisted some diary entries. Now it's time to add some sketches to your diary, like a real person.

Directions

  1. Write a route handler for GET requests made to "/sketches". Make this route render a template called sketches.erb. This template will eventually display a list of sketches, but for now you can leave it blank.
  2. Write a route handler for GET requests made to "/sketches/new". This route handler should render a template that displays a form. Make the form POST to "/sketches".
  3. Give your form two inputs: one a text input and the other a date input.
  • Note: You'll have to give both of these inputs a "name" property
    • in deciding what value to assign the inputs' "name" property, it will be helpful to know that the text input is eventually going to take a URL that points to an image somewhere on the internet, and the date input is going to take a date.
  1. Write a route handler for POST requests made to "/sketches". Make this route save the sketch to a list of sketches, then redirect to the handler for GET requests made to "/sketches".
  2. Test out your form, using binding.pry to make sure your sketches are persisting.
  1. Update your sketches.erb template so that it displays a list of images.
  2. Once all your images are rendering at "/sketches", style the heck out of the page.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment