-
Define CRUD
-
CRUD is an acronym to remember the basic functionality: 'Create', 'Read', 'Update', and 'Delete'
-
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.
-
'/elements' + GET - for viewing all elements.
-
'/elements/:id' + GET - for viewing a specific element.
-
'/elements/new' + GET - for viewing a form to create a new element.
-
'/elements' + POST - for submitting a form to create a new element, redirects to list of all elements.
-
'/elements/:id/edit' + GET - for viewing a form to edit an already-existing element.
-
'/elements/:id' + PUT (PATCH) - for submitting a form that edits an already-existing element.
-
'/elements/:id' + DELETE - for deleting an already-existing element.
-
Why do we use
set method_override: true
? -
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.
-
Explain the difference between
value
andname
in this line:<input type='text' name='task[title]' value="<%= @task.title %>"/>
. -
Value is interpolating ruby so that you get the relevant task's title.
-
What are
params
? Where do they come from? -
Hash containing submitted data, either through a form or through a URL, created by HTTP.
Forked from rwarbelow/cfu_crud_in_sinatra.markdown
Last active
March 23, 2016 04:17
-
-
Save pindell-matt/3f8e35f76793e455d282 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