Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Claudia108/580ad1dcb22d3ccddd13 to your computer and use it in GitHub Desktop.
Save Claudia108/580ad1dcb22d3ccddd13 to your computer and use it in GitHub Desktop.
CRUD in Sinatra -- Check for Understanding
  1. Define CRUD. gives a web application its full functionality for users with 4 interaction modes: 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. '/tasks' + get: shows all entries '/tasks/:id' + get: shows specific entry by id '/tasks/new' + get: shows/renders form to enter new information '/tasks' + post: creates new entry and redirects to 'tasks/:id' '/tasks/:id/edit' + get: shows entry form with entered information to update information '/tasks/:id' + put: overrides existing entry with new information and redirects to '/tasks/:id' '/tasks/:id + delete: deletes specific entry by id
  3. Why do we use set method_override: true? HTTP expects a post verb whenever we use a form
  4. Explain the difference between value and name in this line: <input type='text' name='task[title]' value="<%= @task.title %>"/>. name calls on params hash with the key task[title]. Value shows the value of that specific key.
  5. What are params? Where do they come from? Params is the hash that input from a form is organized in - with the title of the form field as the key and the content of the field as values
@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