Sha256: c383597d73058ce05d10d51b3cfa520003db26938ba38fc138dd60d78093571a

Contents?: true

Size: 1.58 KB

Versions: 10

Compression:

Stored size: 1.58 KB

Contents

# frozen_string_literal: true

module Doorkeeper
  autoload :AccessGrant, "doorkeeper/orm/active_record/access_grant"
  autoload :AccessToken, "doorkeeper/orm/active_record/access_token"
  autoload :Application, "doorkeeper/orm/active_record/application"
  autoload :RedirectUriValidator, "doorkeeper/orm/active_record/redirect_uri_validator"

  module Models
    autoload :Ownership, "doorkeeper/models/concerns/ownership"
  end

  # ActiveRecord ORM for Doorkeeper entity models.
  # Consists of three main OAuth entities:
  #   * Access Token
  #   * Access Grant
  #   * Application (client)
  #
  # Do a lazy loading of all the required and configured stuff.
  #
  module Orm
    module ActiveRecord
      autoload :StaleRecordsCleaner, "doorkeeper/orm/active_record/stale_records_cleaner"

      module Mixins
        autoload :AccessGrant, "doorkeeper/orm/active_record/mixins/access_grant"
        autoload :AccessToken, "doorkeeper/orm/active_record/mixins/access_token"
        autoload :Application, "doorkeeper/orm/active_record/mixins/application"
      end

      def self.run_hooks
        initialize_configured_associations
      end

      def self.initialize_configured_associations
        if Doorkeeper.config.enable_application_owner?
          Doorkeeper.config.application_model.include ::Doorkeeper::Models::Ownership
        end

        Doorkeeper.config.access_grant_model.include ::Doorkeeper::Models::PolymorphicResourceOwner::ForAccessGrant
        Doorkeeper.config.access_token_model.include ::Doorkeeper::Models::PolymorphicResourceOwner::ForAccessToken
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
doorkeeper-5.8.0 lib/doorkeeper/orm/active_record.rb
doorkeeper-5.7.1 lib/doorkeeper/orm/active_record.rb
doorkeeper-5.7.0 lib/doorkeeper/orm/active_record.rb
doorkeeper-5.6.9 lib/doorkeeper/orm/active_record.rb
doorkeeper-5.6.8 lib/doorkeeper/orm/active_record.rb
doorkeeper-5.6.7 lib/doorkeeper/orm/active_record.rb
doorkeeper-5.6.6 lib/doorkeeper/orm/active_record.rb
doorkeeper-5.6.5 lib/doorkeeper/orm/active_record.rb
doorkeeper-5.6.4 lib/doorkeeper/orm/active_record.rb
doorkeeper-5.6.3 lib/doorkeeper/orm/active_record.rb