Skip to content

Instantly share code, notes, and snippets.

@zemd
Created July 12, 2014 21:54
Show Gist options
  • Save zemd/8322a670f3c2a8da0ec6 to your computer and use it in GitHub Desktop.
Save zemd/8322a670f3c2a8da0ec6 to your computer and use it in GitHub Desktop.
string patching to make slug from current value
require 'iconv'
require 'active_support/core_ext/string'
String.class_eval do
def slugify
Iconv.conv('ASCII//TRANSLIT//IGNORE', 'UTF8', self.mb_chars.downcase).parameterize
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment