module Doorkeeper::Models::ResourceOwnerable::ClassMethods

def by_resource_owner(resource_owner)

Returns:
  • (Doorkeeper::AccessGrant, Doorkeeper::AccessToken) -

Parameters:
  • resource_owner (ActiveRecord::Base, Integer) --
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

def resource_owner_id_for(resource_owner)

Returns:
  • (ActiveRecord::Base, Integer) -

Parameters:
  • resource_owner (ActiveRecord::Base, Integer) --
def resource_owner_id_for(resource_owner)
  if resource_owner.respond_to?(:to_key)
    resource_owner.id
  else
    resource_owner
  end
end