Skip to content

Instantly share code, notes, and snippets.

@icorson3
Forked from Carmer/crud.markdown
Last active May 10, 2016 16:56
Show Gist options
  • Save icorson3/a2f816e247028aa10db7916233f1b960 to your computer and use it in GitHub Desktop.
Save icorson3/a2f816e247028aa10db7916233f1b960 to your computer and use it in GitHub Desktop.
  1. Define CRUD. C - Create R - Read U - Update D - 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.

  • GET '/tasks' = reads the index of tasks
  • GET '/tasks/:id' = reads the task with the specific id
  • GET '/tasks/new' = navigates to a new form for tasks to be entered
  • POST '/tasks/' = creates new task in task index
  • GET '/tasks/:id/edit' = navigates to specific id to edit task
  • PUT '/tasks/:id' = edits/updates task information
  • DELETE '/tasks/:id' = deletes a specific tasks
  1. Why do we use set method_override: true?

  2. Explain the difference between value and name in this line: <input type='text' name='task[title]' value="<%= @task.title %>"/>. The value is what the form will be created with as a default value.

  3. What are params? Where do they come from? Params are the information that a form receives. It is usually treated as a hash.

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