-
Define CRUD.
- these are functions that stands for 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.
get '/resources' - this retrieves the resources get '/resource/:id'- this retrieves the one resource get '/resources/new - this retrieves a form or some format for add resource post '/resources' - this creates the new resource get '/resources/:id/update - this retrieves a form that allows a specific resource to be modified or edited put '/resources' - this modifies or edits the specificed resource delete '/resources/:id' - this deletes the specified resource
-
Why do we use
set method_override: true
? -The Get and post requests are universally recognizable but other methods like put and delete are not. So we us the method_override to make a put or delete request look like a post request. -
Explain the difference between
value
andname
in this line:<input type='text' name='task[title]' value="<%= @task.title %>"/>
. -(name)task[title] is getting set to (value)@task.title -
What are
params
? Where do they come from? -params is a hash of attributes and it comes from the information that is passed via a form
/resources/:id/edit
instead of/resources/:id/update