O'Reilly logo

Rails Routing by David A. Black

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 by hand! ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required