Created
May 27, 2016 08:58
-
-
Save adamgavlak/87de4f8a3c5011de5080d30d780409ec to your computer and use it in GitHub Desktop.
Generate slug
This file contains 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
# Generates slug with n characters that matches /[A-Za-z0-9]+/ | |
def generate_slug(n = 7) | |
[*('A'..'Z'), *('a'..'z'), *('0'..'9')].shuffle[0,n].join | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment