I've decided to use human-friendly urls (slugs) for my blog posts. I found the friendly_id gem very easy to use with Rails/ActiveRecord. Here are some of my dev notes:
The rails generate friendly_id command simply generates a migration that builds a "slugs" table:
post.name = "peter_tech_blog_098"
post.content = "a quick brown fox"
<Post id: 202, name: "petertechblog098", title: "my kingdom for a title!", content: "a quick brown fox", createdat: "2011-07-19 00:45:05", updatedat: "2011-07-19 00:45:05", creator: nil, cachedslug: "my-kingdom-for-a-title">
As you can see, friendlyid transforms your sluggable attribute - in this case "title" - into a URL-friendly string. Notice the original (!) is removed.
Your DB rows will still increment normally by id; they just will include the "sluggableid" attribute from now on. This makes friendlyid minimally invasive to your app - anything you were previously doing with id still works.
Friendlyid handles name collisions fairly well:
If you change the title, BOTH links still work:
Another great thing about friendlyid is that it keeps your models at arm's length: no attributes in yours rows are modified; only the "cachedslug" attribute is added.
All slug info is contained in the Slug table:
=> #<Slug id: 5, name: "newest-post", sluggableid: 204, sequence: 1, sluggabletype: "Post", scope: nil, createdat: "2011-07-19 01:23:45">