Class: Doorkeeper::Application

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

Class Method Summary collapse

Methods included from Models::Mongoid4::Scopes

#scopes=

Methods included from ApplicationMixin

#original_scopes, #scopes

Methods included from Models::Scopes

#includes_scope?, #scopes, #scopes_string

Class Method Details

.authorized_for(resource_owner) ⇒ Object


20
21
22
23
# File 'lib/doorkeeper/orm/mongoid2/application.rb', line 20

def self.authorized_for(resource_owner)
  ids = AccessToken.where(resource_owner_id: resource_owner.id, revoked_at: nil).map(&:application_id)
  find(ids)
end

.column_names_with_tableObject


14
15
16
# File 'lib/doorkeeper/orm/active_record/application.rb', line 14

def self.column_names_with_table
  self.column_names.map { |c| "#{table_name}.#{c}" }
end

.create_indexesObject


25
26
27
# File 'lib/doorkeeper/orm/mongo_mapper/application.rb', line 25

def self.create_indexes
  ensure_index :uid, unique: true
end