Module: Locomotive::Concerns::Account::ApiKey
- Extended by:
- ActiveSupport::Concern
- Included in:
- Account
- Defined in:
- app/models/locomotive/concerns/account/api_key.rb
Overview
More information here: github.com/mongoid/mongoid/issues/3626
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#regenerate_api_key ⇒ String
Regenerate the API key without saving the account.
-
#regenerate_api_key! ⇒ Object
Regenerate the API key AND then save the account.
Instance Method Details
#regenerate_api_key ⇒ String
Regenerate the API key without saving the account.
24 25 26 |
# File 'app/models/locomotive/concerns/account/api_key.rb', line 24 def regenerate_api_key self.api_key = Digest::SHA1.hexdigest("#{self._id}-#{Time.now.to_f}-#{self.created_at}") end |
#regenerate_api_key! ⇒ Object
Regenerate the API key AND then save the account.
30 31 32 33 |
# File 'app/models/locomotive/concerns/account/api_key.rb', line 30 def regenerate_api_key! self.regenerate_api_key self.save end |