- Define CRUD. create, read, update, delete. everything a web app should do.
- 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. see all the assets (READ-GET-RENDER) see one of the assets (READ-GET-RENDER) see a form to create a new asset (CREATE-GET-RENDER) submit the filled form, save the new asset (CREATE-POST-REDIRECT) see a form to edit an exsisting asset (UPDATE-GET-RENDER) submit the filled form, save the edited asset (UPDATE-POST-REDIRECT) delete an asset (DELETE-DELETE-REDIRECT)
- Why do we use
set method_override: true
? seems like niether "update", nor "delete" are really things that HTTP expects from a form- it's all just POST, so we have to override the default action? - Explain the difference between
value
andname
in this line:<input type='text' name='task[title]' value="<%= @task.title %>"/>
. value is what will be shown in the form when it appears, name is what will become params, for use after the user hits submit. - What are
params
? Where do they come from? they come from user input fields. they are hashes, keys are defined by the input tags.
Forked from rwarbelow/cfu_crud_in_sinatra.markdown
Last active
March 23, 2016 04:16
-
-
Save jeneve/cffdecf6001096754650 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
we use method_override because http doesn't handle put and delete verbs - so we use the _method as the name of the hidden input field of a form so we can pass the verb through to the controller.