Chapter 3. The Routing System
The Two Faces of Routing
The routing system does two things: It recognizes URLs and it generates URLs.
Recognizing URLs is useful because itâs how your application decides what itâs supposed to do when a particular request comes in:
http://localhost:3000/recipes_for/apples What do we do now?!
Generating URLs is useful because it allows you to use relatively high-level syntax in your view templates and controllers when you need to insert a URLâso you donât have to do this:
<a href="http://localhost:3000/recipes_for/apples">Apple recipes</a>
Not much fun having to type this out ...
Get Rails Routing now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.