Skip to content

Instantly share code, notes, and snippets.

@soveran
Created May 26, 2010 23:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save soveran/415194 to your computer and use it in GitHub Desktop.
Save soveran/415194 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