Skip to content

Instantly share code, notes, and snippets.

@neurotech
Forked from schneems/gist:3029994
Created November 20, 2012 09:37
Show Gist options
  • Save neurotech/4116984 to your computer and use it in GitHub Desktop.
Save neurotech/4116984 to your computer and use it in GitHub Desktop.
Databases and Rails Recap Quiz for Week 4

1) What does MVCr stand for?

Model View Controller Route

2) In what file do we store 'r' from MVCr ?

/config/routes.rb

3) What two components make up a route

The URL and HTTP verb

4) Why are Rails routes REST(ful) ?

The request state changes the intent.

5) Match the data operations to the HTTP Verbs

[GET, POST, DELETE, PUT]

  1. Create - POST
  2. Read - GET
  3. Update - PUT
  4. Destroy - DELETE

6) Fill out the values below based on this log entry:

Started GET "/products/new" for 127.0.0.1 at 2012-06-28 11:33:36 -0700
Processing by ProductsController#new as HTML
  Rendered products/new.html.erb within layouts/application (0.4ms)
Completed 200 OK in 11ms (Views: 9.3ms | ActiveRecord: 0.0ms)

Was the request successful, why or why not? Yes. Line 4 states that the operation completed with the status of 200 OK.

What view file was rendered? products/new.html.erb

What path was this request to? /products/new

What Controller was used? ProductsController

7) Build a route based on the log entry in the last exercise that maps from the correct url and verb to the correct controller and view.

get '/products/new' => 'products#new'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment