Friendly URL
By Jiazhen Xie | 7 November 2013
Tags: web, seo, rails, ruby
This is a great article Friendly URLs. So that I repost here. By default, Rails applications build URLs based on the primary key -the column from the database. Imagine we have a model and associated controller. We have a person record for that has number . The URL for his show page would be: But, for aesthetic or SEO purposes, we want Bob's name in the URL. The last segment, the here, is called the "slug". Let's look at a few ways to implement better slugs. Simple Approach The simplest approach ...
← Back to Home