Module: Doorkeeper::Models::ResourceOwnerable::ClassMethods

Defined in:
lib/doorkeeper/models/concerns/resource_ownerable.rb

Instance Method Summary collapse

Instance Method Details

#by_resource_owner(resource_owner) ⇒ Doorkeeper::AccessGrant, Doorkeeper::AccessToken

Searches for record by Resource Owner considering Doorkeeper configuration for resource owner association.

Parameters:

  • resource_owner (ActiveRecord::Base, Integer)

    resource owner

Returns:



18
19
20
21
22
23
24
# File 'lib/doorkeeper/models/concerns/resource_ownerable.rb', line 18

def by_resource_owner(resource_owner)
  if Doorkeeper.configuration.polymorphic_resource_owner?
    where(resource_owner: resource_owner)
  else
    where(resource_owner_id: resource_owner_id_for(resource_owner))
  end
end