Chapter 5. Named Routes

Although this is a short section, the topic of named routes definitely deserves a section of its own. And what you learn here will feed directly into our examination of REST-related routing a little later.

The idea of naming a route is basically to make life easier on you, the programmer. When you name a route, a new method gets defined for use in your controllers and views; the method is called name_url (with name being the name you gave the route), and calling the method, with appropriate arguments, results in a URL being generated for the route. In addition, a method called name_path also gets created; this method generates ...

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.