- Define CRUD. Create, read, update, destroy - this is the base functionality that all applications should provide
- 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, /tasks - shows all tasks Get, /tasks/:id - shows one task Get, /tasks/new - shows form for task creation Post, /tasks - submits task content and creates object Get, /tasks/:id/edit - shows form to edit task info Put, /task/:id - submits changes to task info Delete, /task/:id - delets task
- Why do we use
set method_override: true
? because we want to override the default method for our forms - change from post? - Explain the difference between
value
andname
in this line:<input type='text' name='task[title]' value="<%= @task.title %>"/>
. name represents what we will tell params we are looking for and value represents the contents of the object found at value - What are
params
? Where do they come from? params is the hash that contains all content from our YAML database
Forked from rwarbelow/cfu_crud_in_sinatra.markdown
Last active
March 23, 2016 04:16
-
-
Save patrickwhardy/1fbdb4f19f4dfb416f9f to your computer and use it in GitHub Desktop.
CRUD in Sinatra -- Check for Understanding
Params is a hash of data that comes from a request. The request can be sent from a page that had a form and the data was gather from the form and passed through to the controller. Params can also be sent through the url. params are anything after a ?
in the url and are separated by a &. For example: www.thingplace.com/things/5?name=dog&description=cute
This example would give us params like this: params = {"name" => "dog", "description" => "cute"}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
figured it out - enter is not creating new lines so the formatting is just wonky