- Define CRUD.
- 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.
- Why do we use
set method_override: true
? - Explain the difference between
value
andname
in this line:<input type='text' name='task[title]' value="<%= @task.title %>"/>
. - What are
params
? Where do they come from?
-
-
Save cheljoh/e0cd9a6ab2d9a6cb5996 to your computer and use it in GitHub Desktop.
CRUD in Sinatra -- Check for Understanding
Author
cheljoh
commented
Feb 2, 2016
- CRUD is an acronym that stands for creating, reading, updating, and deleting in regards to the maintenance and storage of information.
- GET and '/tasks'- allow us to view all tasks
- GET and '/tasks/:id'- allow us to view one task
- GET and '/tasks/new'- allow us to view new form
- POST and 'tasks'- allow us to save information and view all tasks
- GET and '/tasks/:id/edit'-allow us to view new form to update task
- PUT and '/tasks/:id'-allow us to save updated task
- DELETE and 'tasks/:id'-allow us to delete specific task
- We set method_override to true in order to use put and delete methods (browsers just read get and post)
- task[title] is accessing a value of a hash, @task.title is accessing an attribute of an object and is actually viewable in the browser
- Params are a hash that allow us to access route patterns and are located in the request body (still don't 100% understand this)
- 👍
- 👍 (remember to include the leading "/" on POST)
- 👍
- Check the initial question on this one.
- Params can be data from a form or data from the URL
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment