Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save pindell-matt/3f8e35f76793e455d282 to your computer and use it in GitHub Desktop.
Save pindell-matt/3f8e35f76793e455d282 to your computer and use it in GitHub Desktop.
CRUD in Sinatra -- Check for Understanding
  1. Define CRUD

  2. CRUD is an acronym to remember the basic functionality: 'Create', 'Read', 'Update', and 'Delete'

  3. There are seven verb + path combinations that are necessary in a basic Sinatra app in order to provide full CRUD functionality. List each of the seven combinations, and explain what each is for.

  4. '/elements' + GET - for viewing all elements.

  5. '/elements/:id' + GET - for viewing a specific element.

  6. '/elements/new' + GET - for viewing a form to create a new element.

  7. '/elements' + POST - for submitting a form to create a new element, redirects to list of all elements.

  8. '/elements/:id/edit' + GET - for viewing a form to edit an already-existing element.

  9. '/elements/:id' + PUT (PATCH) - for submitting a form that edits an already-existing element.

  10. '/elements/:id' + DELETE - for deleting an already-existing element.

  11. Why do we use set method_override: true?

  12. In order to use "_method" in the form and override the verb so that we can submit a Put/Patch or Delete verb instead of Post.

  13. Explain the difference between value and name in this line: <input type='text' name='task[title]' value="<%= @task.title %>"/>.

  14. Value is interpolating ruby so that you get the relevant task's title.

  15. What are params? Where do they come from?

  16. Hash containing submitted data, either through a form or through a URL, created by HTTP.

@Carmer
Copy link

Carmer commented Mar 23, 2016

looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment