Skip to content

Instantly share code, notes, and snippets.

@pyk
Forked from schneems/gist:3029994
Last active August 29, 2015 13:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pyk/8718360 to your computer and use it in GitHub Desktop.
Save pyk/8718360 to your computer and use it in GitHub Desktop.
## 1) What does MVCr stand for?
Model, View, Controller (routes)
## 2) In what file do we store 'r' from MVCr ?
config/routes.rb
## 3) What two components make up a route
URL and HTTP verb (GET,POST,PUT,DELETE)
## 4) Why are Rails routes REST(ful) ?
because it has diferent state in same url path
## 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? succesfull, beacuse it says 200 OK
What view file was rendered? products/new.html.erb
What path was this request to ? /products/new
What Controller was used ? PorductsController
## 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