- Define CRUD. CRUD stands for Create, Read, Update, and Delete. These are the main functions that we can do to data.
- 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: Read all tasks get + /tasks/:id: Read specific task get + /tasks/new: get form to fill out new task post + /tasks: Create a new task get + /tasks/:id/edit: See form to edit task info put + /tasks/:id: change task delete + /tasks/:id: delete a task
- Why do we use
set method_override: true
? Because we need to overwrite post with put and delete - Explain the difference between
value
andname
in this line:<input type='text' name='task[title]' value="<%= @task.title %>"/>
. the name field denotes the name of the variable stored in the database, the value is the value stored in the particular name field. - What are
params
? Where do they come from? That is what is sent by the forms
Forked from rwarbelow/cfu_crud_in_sinatra.markdown
Last active
March 23, 2016 04:26
-
-
Save drew-t/72973578d0eb4524f78e to your computer and use it in GitHub Desktop.
CRUD in Sinatra -- Check for Understanding
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looks good. Just a note - the name field in the input of the form is what will defined the name of the key in the params hash, we write it so it represents something in a database, but it doesn't 'have to be' something in the database