5.3.2 Rails Routes

Now that we have tests for the URLs we want, it’s time to get them to
work. As noted in Section 3.1, the file Rails uses for URL mappings is
config/routes.rb. If you take a look at the default routes file, you’ll
see that it’s quite a mess, but it’s a useful mess—full of commented-out
example route mappings. I suggest reading through it at some point, and
I also suggest taking a look at the Rails Guides article “Rails Routing
from the outside in” for a much more in-depth treatment of routes.

To define the named routes, we need to replace rules such as

get 'static_pages/help'

with

match '/help', to: 'static_pages#help', via: 'get'