Sha256: 2fa150ca46d11e3e01c8f074c87ebf33d0e91d8ea1afbee29dac0e965870f330
Contents?: true
Size: 867 Bytes
Versions: 5
Compression:
Stored size: 867 Bytes
Contents
module Doorkeeper class Application < ActiveRecord::Base self.table_name = "#{table_name_prefix}oauth_applications#{table_name_suffix}".to_sym include ApplicationMixin if ActiveRecord::VERSION::MAJOR >= 4 has_many :authorized_tokens, -> { where(revoked_at: nil) }, class_name: 'AccessToken' else has_many :authorized_tokens, class_name: 'AccessToken', conditions: { revoked_at: nil } end has_many :authorized_applications, through: :authorized_tokens, source: :application def self.column_names_with_table self.column_names.map { |c| "#{table_name}.#{c}" } end def self.authorized_for(resource_owner) joins(:authorized_applications). where(AccessToken.table_name => { resource_owner_id: resource_owner.id, revoked_at: nil }). group(column_names_with_table.join(',')) end end end
Version data entries
5 entries across 5 versions & 1 rubygems