Created
July 12, 2014 21:54
-
-
Save zemd/8322a670f3c2a8da0ec6 to your computer and use it in GitHub Desktop.
string patching to make slug from current value
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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