Class: Doorkeeper::AccessToken

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
AccessTokenMixin, Models::Mongoid2::Scopes, Models::Mongoid3::Scopes, Models::Mongoid4::Scopes, MongoMapper::Document, Mongoid::Document, Mongoid::Timestamps
Defined in:
lib/doorkeeper/orm/mongoid3/access_token.rb,
lib/doorkeeper/orm/mongoid4/access_token.rb,
lib/doorkeeper/orm/mongoid2/access_token.rb,
lib/doorkeeper/orm/mongo_mapper/access_token.rb,
lib/doorkeeper/orm/active_record/access_token.rb

Class Method Summary collapse

Methods included from Models::Mongoid4::Scopes

#scopes=

Methods included from AccessTokenMixin

#acceptable?, #as_json, #same_credential?, #token_type, #use_refresh_token?

Methods included from Models::Scopes

#includes_scope?, #scopes, #scopes_string

Methods included from Models::Accessible

#accessible?

Methods included from Models::Revocable

#revoke, #revoked?

Methods included from Models::Expirable

#expired?, #expires_in_seconds

Class Method Details

.create_indexesObject


30
31
32
33
# File 'lib/doorkeeper/orm/mongo_mapper/access_token.rb', line 30

def self.create_indexes
  ensure_index :token, unique: true
  ensure_index [[:refresh_token, 1]], unique: true, sparse: true
end

.created_at_descObject


17
18
19
# File 'lib/doorkeeper/orm/active_record/access_token.rb', line 17

def self.created_at_desc
  'created_at desc'
end

.lastObject


20
21
22
# File 'lib/doorkeeper/orm/mongo_mapper/access_token.rb', line 20

def self.last
  self.sort(:created_at).last
end

.order_methodObject


13
14
15
# File 'lib/doorkeeper/orm/active_record/access_token.rb', line 13

def self.order_method
  :order
end