You are previewing Rails 3 in Action.

Rails 3 in Action

Cover of Rails 3 in Action by Ryan Bigg... Published by Manning Publications
O'Reilly logo

Appendix B. Tidbits

This appendix contains a collection of tidbits that we just couldn’t fit into the rest of the book. They are designed to be read by themselves, although you are welcome (and encouraged!) to read as many of them at once as you wish.

B.1 Prettying URLs

In your application you’ve got a URL such as /projects/1/tickets/2, which really isn’t that pretty. Let’s take a look at how you can make the ticket’s ID part of these URLs a little prettier, turning them into something like /projects/1/tickets/2-make-it-shiny.

Having URLs such as /projects/1/tickets/2-make-it-shiny will allow your users to easily identify what that URL links to without having to visit the page.[1] Rails allows you to very easily do this by overriding a method ...

The best content for your career. Discover unlimited learning on demand for around $1/day.