Class: DeviseMultipleTokenAuth::Device

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.destroy_expiredObject



7
8
9
# File 'app/models/devise_multiple_token_auth/device.rb', line 7

def self.destroy_expired
  DeviseMultipleTokenAuth::Device.expired.destroy_all
end

Instance Method Details

#cleanup_push_tokens!Object



11
12
13
14
15
16
# File 'app/models/devise_multiple_token_auth/device.rb', line 11

def cleanup_push_tokens!
  self.class.where.not(id:self.id).where(push_token:self.push_token).each do |other_device|
    other_device.push_token = nil
    other_device.save
  end
end

#expired?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'app/models/devise_multiple_token_auth/device.rb', line 18

def expired?
  expires_at < Time.now
end