Skip to content

Instantly share code, notes, and snippets.

View jamesbrooks's full-sized avatar

James Brooks jamesbrooks

View GitHub Profile
class String
def slugify
returning self.downcase.gsub(/'/, '').gsub(/\//, ' ').gsub(/&/, ' and ').gsub(/[^a-z0-9]+/, '-') do |slug|
slug.chop! if slug.last == '-'
end
end
end