Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save allindow/6e1504f59ca9553546fc80acf0689c5a to your computer and use it in GitHub Desktop.
Save allindow/6e1504f59ca9553546fc80acf0689c5a to your computer and use it in GitHub Desktop.
Intro to Rails Routing Warm-Up Questions
  1. What is the purpose of the router in a Rails project? -It is the doorman to the app, matches the verb to the controller
  2. What routes would be provided to you with the line resources :items? -Get index, Get show, get new, post create, get edit, put update, delete destroy
  3. What does root :to => "items#index" represent? How would you access that route in a web app? -it tells the app where to go if the root url is accessed. You would access it like, www.items.com
  4. What rake task is useful when looking at routes, and what information does it give you? -rake routes, outputs all routes available to the app
  5. How would you interpret this output: items GET /items(.:format) items#index -In the items controller, the action is index, making a get request to /items with the option file extension, use the edit route
  6. What is one major similiarity between Rails routing + controllers and the Sinatra projects we've been building? -using RESTful routes
  7. What is one major difference between Rails routing + controllers and the Sinatra projects we've been building? -rather than explicitly saying what those routes are, we're just doing resources :posts and Rails builds the routes for us
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment