Sexy URLs, or, Default Routes Considered Harmful
Thursday, September 25th, 2008Generating anonymous routes is very freaking expensive because Rails has to try generating every possible route you have listed. Use either named routes or helper/model methods if you’ve got lots of links on a page and are worried about performance.
URLs are first sight of your app’s GUI — If every Rails developer said that to themselves, there wouldn’t be a deployed default routes.rb left on the Internet. A URL is not just an arbitrary string of characters which identifies a resource on the Internet. A URL does not merely identify, it also describes what comes behind it, both to end users and, critically, to search engine crawlers. Take a look at these two URL pairs:
* www.smarteguru.com/card/show/116
* www.smarteguru.com/category/show/16
(more…)
