Created
October 7, 2009 01:29
-
-
Save uhhuhyeah/203634 to your computer and use it in GitHub Desktop.
Random String example for http://uhhuhyeah.com/distractions/random-strings-in-ruby
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
def create_token | |
self.token = secure_digest(Time.now, self.id, (1..10).map{ rand.to_s }) | |
end | |
def secure_digest(*args) | |
Digest::SHA1.hexdigest(args.flatten.join('--')) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment