Skip to content

Instantly share code, notes, and snippets.

@shishi
Created March 11, 2014 10:04
Show Gist options
  • Save shishi/9482795 to your computer and use it in GitHub Desktop.
Save shishi/9482795 to your computer and use it in GitHub Desktop.
# 1
begin
key = SecureRandom.hex 5
end while self.find_by(migration_key: key)
key
# 2
key = SecureRandom.hex 5
if User.find_by(migration_key: key)
create_migration_key
else
key
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment