-
Define CRUD. - 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. a. (get - /folder) - get all items in folder b. (get - /folder/:id) - get single item in folder c. (get - /folder/new) - get view with form to create new view d. (post - /folder) - post new item e. (get - /folder/:id/edit) - get form to edit exisiting item f. (put - /folder/:id) - update existing item g. (delete - /folder/:id) - delete item based on id
-
Why do we use
set method_override: true
? - to allow us to give buttons another method instead of POST -
Explain the difference between
value
andname
in this line:<input type='text' name='task[title]' value="<%= @task.title %>"/>
. - name is what is going to be sent when the form is submitted, value is what populates the text field. -
What are
params
? Where do they come from? - params come from form submission? i think?
Forked from rwarbelow/cfu_crud_in_sinatra.markdown
Last active
March 23, 2016 04:28
-
-
Save notmarkmiranda/94e66694bff05c5aa5fe 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
Params come from submitting a form, or they can also be sent through in the url. If you see a
?
in a url - it signals the start of params. So - if we have a url like this:www.thingplace.com/places/5?name=ocean&description=wet
then we will get params like:params = { "name" => "ocean", "description" => "wet"}