- Define CRUD.
- The acronym for the basic actions carried out in web applications: 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.
- Read / GET - Displaying the collection
- Read / GET - Displaying an item
- Create / GET - Displaying the form for creating an item
- Create / POST - Submitting the info from that form for creation
- Update / GET - Displaying the form for changing an item
- Update / PUT - Submitting the info from that form for changing
- Delete / DELETE - Removing a designated item
- Why do we use
set method_override: true
?
- HTTP doesn't actually know how to handle PUT or DELETE, so we need to override it's default behavior
- Explain the difference between
value
andname
in this line:<input type='text' name='task[title]' value="<%= @task.title %>"/>
.
- Value is the title contents (In this example) of @task that are displayed in the form when the page is loaded
- Name is the value passed when the form is submitted
- What are
params
? Where do they come from?
- params is the hash of string values passed via HTML post when a form is submitted
looks good