Skip to content

Instantly share code, notes, and snippets.

@sinefunc
Forked from soveran/slug.rb
Created May 26, 2010 23:01
Show Gist options
  • Save sinefunc/415196 to your computer and use it in GitHub Desktop.
Save sinefunc/415196 to your computer and use it in GitHub Desktop.
module Slug
def to_param
"#{super}-#{slug}"
end
def slug
to_s.gsub("'", "").gsub(/\p{^Alnum}/u, " ").strip.gsub(/\s+/, "-").downcase
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment