Skip to content

Instantly share code, notes, and snippets.

Created December 4, 2012 21:20
What would you like to do?
# Generate a token by looping and ensuring does not already exist.
def generate_token(column)
loop do
token = Devise.friendly_token
break token unless to_adapter.find_first({ column => token })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment