Skip to content

Instantly share code, notes, and snippets.

@nuclearsandwich
Created July 15, 2012 19:10
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 nuclearsandwich/3118198 to your computer and use it in GitHub Desktop.
Save nuclearsandwich/3118198 to your computer and use it in GitHub Desktop.
Ruby Sunday Homework
posts GET /posts(.:format) posts#index
POST /posts(.:format) posts#create
new_post GET /posts/new(.:format) posts#new
edit_post GET /posts/:id/edit(.:format) posts#edit
post GET /posts/:id(.:format) posts#show
PUT /posts/:id(.:format) posts#update
DELETE /posts/:id(.:format) posts#destroy

Ruby Sunday Homework for July 15

Assignment

Using: FluffyCode/reddit2 or a fork of it.

Replace the resources :posts declaration in config/routes.rb with an expanded version specifying each route.

When finished, run rake routes and compare it the gist file rake_routes_output.txt

Afterwards create a file routes_quiz_answers.txt and give the answers to the following questions.

  1. What action is called when a GET request to /posts occurs?
  2. What helper should I use if I want to create a relative link to the posts#new action?
  3. If I have my rails server on port 3000 and I go to localhost:3000/posts/4 in my browser, what is the HTTP verb? What Rails action will be called?

The Ruby on Rails Guides will be helpful. Particularly this one on routes.

Instructions

Fork this gist and add two files routes_quiz_answers.txt and my_rake_routes_output.txt. Then post a comment to this gist linking to yours in order to get graded.

License

This assignment is licensed under the Creative Commons Share-Alike, Non-Commercial, Attribution (CC-BY-NC-SA) and I'd really like to hear from you if you use it.