Class: ApiToken

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/api_token.rb

Instance Method Summary collapse

Instance Method Details

#generate_tokenObject


10
11
12
13
14
# File 'app/models/api_token.rb', line 10

def generate_token
  begin
    self.access_token = SecureRandom.hex
  end while self.class.exists?(access_token: access_token)
end