Creating a Route4:45 with Jay McGavren
Rails lets you set up "routes" for requests, so that you can send a particular request to a controller that can handle it.
To set up a route to the index of all
Page objects, we add a line like this in
get '/pages', to: 'pages#index'`
In plain English, you could read this as "GET requests for the '/pages' path should go to the PagesController's 'index' method".
The result is a route like this:
$ bin/rails routes Prefix Verb URI Pattern Controller#Action pages GET /pages(.:format) pages#index
You can read more about GET routes in the official Rails documentation.
You need to sign up for Treehouse in order to download course files.Sign up