Module: User::AuthenticationToken::ClassMethods

Defined in:
app/models/user/authentication_token.rb

Instance Method Summary collapse

Instance Method Details

#authentication_tokenObject

Generate a token checking if one does not already exist in the database.


20
21
22
23
24
25
# File 'app/models/user/authentication_token.rb', line 20

def authentication_token
  loop do
    token = Devise.friendly_token(30)
    break token unless User.exists?(authentication_token: token)
  end
end