Squish the slug the Rails way

Thursday, November 6th, 2008 @ 10:42 am | Ruby, Web Development

Recently Pat wrote about writing a quick method for making URL slugs. In the spirit of sharing I thought I’d mention a strategy I use in a number of the Rails apps I work on:

Take this code put it in a file named inflectors.rb in your config/initializers directory, and you’re good to go.

Tags: , , , ,

One Response to “Squish the slug the Rails way”

  1. Patrick Reagan Says:

    I’ve always wondered why this isn’t built in to Rails - you should take this and submit it as a patch. I was thinking about cleaning mine up and doing something similar, but your version is way more robust.

Leave a Reply