Skip to content

Instantly share code, notes, and snippets.

@scottwb
Created December 4, 2012 21:20
Embed
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 })
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment