Skip to content

Instantly share code, notes, and snippets.

@vitaliel
Created May 1, 2009 13:19
Show Gist options
  • Save vitaliel/105038 to your computer and use it in GitHub Desktop.
Save vitaliel/105038 to your computer and use it in GitHub Desktop.
# add chars at beginning, last should be \\
BAD_URL_CHARS = "<>\"'\r\n #:/&;,%.=?\\"
# This id will be used in links
def to_param
if new_record?
"new-milestone"
else
"#{id}-#{title.tr(BAD_URL_CHARS, "-")}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment