- Define CRUD. The 4 functions you need to be able to implement in a web app for a user to interact with data: 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 /collection : get the full set of data being stored GET /collection/1 : get an individual object that's being stored GET /collection/add : Gives the user the ability to add new information to the collection POST /collection : Submits the new data from the user GET /collection/1/edit : Gives the user the ability to update information about an item in the collection through a form PUT /collection/1 : Returns the updated information to the server through submitting the form DELETE /tasks/id/delete " Allows the user to remove data from the collection
- Why do we use
set method_override: true
? To access verbs that aren't implemented in most browsers, i.e., delete and put/patch. This lets us define these methods to update and delete data. - Explain the difference between
value
andname
in this line:<input type='text' name='task[title]' value="<%= @task.title %>"/>
. Name identifies the data to be passed back to the server, value is what string is displayed to the user with HTML. - What are
params
? Where do they come from? Params come from URLs or forms and store data in hash form to be sent to the server.
Forked from rwarbelow/cfu_crud_in_sinatra.markdown
Last active
February 2, 2016 23:07
-
-
Save hhoopes/c11d25c07682249cf7ba to your computer and use it in GitHub Desktop.
CRUD in Sinatra -- Check for Understanding
rwarbelow
commented
Feb 2, 2016
- ✅ CRUD can also be used beyond web apps -- think of these as the basic functions for any stored data.
- ✅
- ✅
- ✅
- ✅
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment