Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alishersadikov/1f3f3d3ca457c5ac5ce2708e03629ddb to your computer and use it in GitHub Desktop.
Save alishersadikov/1f3f3d3ca457c5ac5ce2708e03629ddb to your computer and use it in GitHub Desktop.
Intro to Rails Routing Warm-Up Questions

Fork this gist. Answer the questions to your best ability and with limited research. No need to post your gist in the comments.

  1. What is the purpose of the router in a Rails project?

    It is like a doorman of the application that knows where to go and what action to take once HTTP request has been received.

  2. What routes would be provided to you with the line resources :items?

    :items routes, I assume, which is probably some controller class

  3. What does root :to => "items#index" represent? How would you access that route in a browser?

    it represents the action of index that needs to take place if routed this way. It is accessed from homepage.

  4. What rake task is useful when looking at routes, and what information does it give you?

    rake routes - shows the routes built in the application

  5. How would you interpret this output: items GET /items(.:format) items#index

    I assume it has to do with formatting the items table/database and then displaying all items

  6. What is one major similiarity between Rails routing + controllers and the Sinatra projects we've been building?

    CRUD functionality

  7. What is one major difference between Rails routing + controllers and the Sinatra projects we've been building?

    In Rails, resources :posts creates all seven routes, whereas they need to be built in Sinatra.

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