- Define CRUD.
Create Read Update 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.
/some_object GET - to provide an :index view that includes all the objects /some_object/:id GET - to provide a :show view that includes a single object /some_object/new GET - to provide a :new view that includes a form to create a new object /some_object POST - to actually create the new object and redirect to another route /some_object/:id/edit GET - to send the user to a form in the :edit view allowing the user to edit an object /some_object PUT - to update an individual object and redirect the user to another route /some_object/:id DELETE - to delete an individual object and redirect the user to another route
- Why do we use
set method_override: true
?
So that we can override the default verb used in a form for a put/patch or delete.
- Explain the difference between
value
andname
in this line:<input type='text' name='task[title]' value="<%= @task.title %>"/>
.
name is the name of the input field that is provided to our app when we hit submit. value is a pre-populated value that is included in that input field.
- What are
params
? Where do they come from?
params are the parameters included in the params hash that are sent in an http request body. They can be passed to an app as part of a link (e.g. someserver.com/?first_name=Sal&last_name=Espinosa) or when a form is submitted.
looks good Sal