Just recently I made a very minor update to my slugify method I use in rails (which I add to String via a monkey-patch).

It’s pretty much like your stock-standard slugification method, this one produces a URL-friendly slug containing only letters and numbers, dashes seperate elements in the string and a few other nice things (single quotation marks are just stripped and not made spaces, and ‘&’ is replaced with ‘and’).

class String
  def slugify
    self.downcase.gsub(/&/, ' and ').gsub(/[^a-z0-9']+/, '-').gsub(/^-|-$|'/, '')
  end
end