Skip to content

Instantly share code, notes, and snippets.

@julyytran
Forked from rwarbelow/cfu_crud_in_sinatra.markdown
Last active February 3, 2016 20:12
Show Gist options
  • Save julyytran/4859d3dea79c63cf6834 to your computer and use it in GitHub Desktop.
Save julyytran/4859d3dea79c63cf6834 to your computer and use it in GitHub Desktop.
CRUD in Sinatra -- Check for Understanding
  1. Define CRUD. All the functionality expected from a database application: create, read, update, delete

  2. 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.

  3. get /tasks shows all of the tasks

  4. get /tasks/:id shows a single task

  5. get /tasks/new show form to make a new task

  6. post /tasks makes a new task

  7. get /tasks/:id/edit shows form to update a task

  8. put /tasks/:id updates a specific task

  9. delete /tasks/:id deletes a task

  10. Why do we use set method_override: true? It lets us use hidden methods to replace a post with put or delete

  11. Explain the difference between value and name in this line: <input type='text' name='task[title]' value="<%= @task.title %>"/>. Name is what the input is called, while value is the content of the input box that the user sees

  12. What are params? Where do they come from? Params are information from the request; they are in the url for a get and are in the body for a post.

@rwarbelow
Copy link

  1. ๐Ÿ‘
  2. ๐Ÿ‘
  3. ๐Ÿ‘
  4. ๐Ÿ‘ name is what we use to access the value from the parameters (params[:name])
  5. ๐Ÿ‘

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