Class: PersonalAccessTokens::LastUsedService
- Inherits:
-
Object
- Object
- PersonalAccessTokens::LastUsedService
- Defined in:
- app/services/personal_access_tokens/last_used_service.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(personal_access_token) ⇒ LastUsedService
constructor
A new instance of LastUsedService.
Constructor Details
#initialize(personal_access_token) ⇒ LastUsedService
Returns a new instance of LastUsedService.
5 6 7 |
# File 'app/services/personal_access_tokens/last_used_service.rb', line 5 def initialize(personal_access_token) @personal_access_token = personal_access_token end |
Instance Method Details
#execute ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'app/services/personal_access_tokens/last_used_service.rb', line 9 def execute # Needed to avoid calling service on Oauth tokens return unless @personal_access_token.has_attribute?(:last_used_at) # We _only_ want to update last_used_at and not also updated_at (which # would be updated when using #touch). @personal_access_token.update_column(:last_used_at, Time.zone.now) if update? end |