- Define CRUD.
- Create. Read. Update. Delete.
- CRUD references the types of functions/verbs that exist in a database.
- 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.
- specific to the Task Manager app...
- read -> '/tasks' -> see all tasks, render :index view
- read -> '/tasks/#{id}' -> see single task with specific task id, render :show view
- create -> '/tasks/new' -> see form to input task info, render :new view
- create -> '/tasks' -> submit task to be saved, redirect to '/tasks/#{id}' or '/tasks' (design decision)
- update -> '/tasks/#{id}/edit' -> see form to edit task info, render :edit view
- update -> '/tasks/#{id}' -> click subit and saved updated info, redirect to '/tasks/#{id}' or '/tasks' (design decision)
- delete -> '/tasks/#{id}' -> delete a particular task, redirect to '/tasks'
- Why do we use
set method_override: true
?
- This will enable overriding a method/verb that is defaulted to an element such as a form with other inputs
- Explain the difference between
value
andname
in this line:<input type='text' name='task[title]' value="<%= @task.title %>"/>
.
- Information submitted through a form will be stored in a params hash. The name will be a hash key and the value will specific to the hash key specified with the task title.
- What are
params
? Where do they come from?
- See response in question 4.
name in the is what defines the key of the params hash, and value is what is actually in the input field on the document.