-
Define CRUD.
- Create, Read, Update, Delete. Describes the type of actions one should be able to do to the 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.
-
- See all: '/tasks' + GET
-
- See one: '/tasks/:id' + GET
-
- Form to create (part 1): '/tasks/new' + GET
-
- Create from form (part 2): '/tasks' + POST
-
- Form to update (part 1): '/tasks/:id/edit' + GET
-
- Update from form (part 2): '/tasks/:id' + PUT
-
- Delete one: '/tasks/:id' + DELETE
-
-
Why do we use
set method_override: true
?- Modern browsers have not agreed upon a way to use PUT or DELETE yet. As a result, we have to use a few creative solutions to be able to use these other 2 verbs, and they use method_override to do it.
-
Explain the difference between
value
andname
in this line:<input type='text' name='task[title]' value="<%= @task.title %>"/>
.- I believe that in this instance the 'name' is being used to denote by what name the data being input will be referred to, while the 'value' is what that data actually is.
-
What are
params
? Where do they come from?- Params are the data input by the user, they come from the form fields provided in the app.
Forked from rwarbelow/cfu_crud_in_sinatra.markdown
Last active
December 2, 2015 15:51
-
-
Save GregoryArmstrong/2b34a8dc0c9a7702d24c 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
Looks good!
#4: value is what will be displayed in the html to the user
#5: params can also come from the URL