Fork this gist. Answer the questions to your best ability and with limited research. No need to post your gist in the comments.
-
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.
-
What routes would be provided to you with the line
resources :items
?:items routes, I assume, which is probably some controller class
-
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.
-
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
-
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
-
What is one major similiarity between Rails routing + controllers and the Sinatra projects we've been building?
CRUD functionality
-
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.