Skip to content

Instantly share code, notes, and snippets.

@case-eee
Last active April 4, 2019 06:36
Show Gist options
  • Save case-eee/1f066fa3be100f8f18f4d31f521a3da4 to your computer and use it in GitHub Desktop.
Save case-eee/1f066fa3be100f8f18f4d31f521a3da4 to your computer and use it in GitHub Desktop.
CRUD CFU Questions
  1. Define CRUD.

  2. Why do we use set method_override: true?

  3. Explain the difference between value and name in this line: <input type='text' name='task[title]' value="<%= @task.title %>"/>.

  4. What are params? Where do they come from?

  5. Check out your routes. Why do we need two routes each for creating a new Task and editing an existing Task?

@liambarstad
Copy link

  1. Create, read, update, destroy = the concept that each element of a database needs to be able to be created, read, updated, and destroyed through the controller/view
  2. it allows you to call methods in your controller that are otherwise unable to be interpreted by HTML
  3. name='task[title]' is implying that the value of this text input will be the value for "title" in the parameter hash, value="<%= @task.title %>"/> is implying that the default value of this text box will be the title associated with the ruby object "task"
  4. params are values taken from the HTML, whenever an input or value has a name="..."
  5. the /edit route and the /new route both make different requests to the SQL database through the ruby class Task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment