Module: User::AuthenticationToken

Extended by:
ActiveSupport::Concern
Included in:
User
Defined in:
app/models/user/authentication_token.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#ensure_authentication_token!Object

Generate authentication token unless already exists and save the record.


14
15
16
# File 'app/models/user/authentication_token.rb', line 14

def ensure_authentication_token!
  reset_authentication_token! if authentication_token.blank?
end

#reset_authentication_token!Object

Generate new authentication token and save the record.


8
9
10
11
# File 'app/models/user/authentication_token.rb', line 8

def reset_authentication_token!
  self.authentication_token = self.class.authentication_token
  save(validate: false)
end