module Doorkeeper::Orm::ActiveRecord

Public Class Methods

check_requirements!(_config) click to toggle source
# File lib/doorkeeper/orm/active_record.rb, line 22
      def self.check_requirements!(_config)
        if ::ActiveRecord::Base.connected? &&
           ::ActiveRecord::Base.connection.table_exists?(
             Doorkeeper::Application.table_name
           )
          unless Doorkeeper::Application.new.attributes.include?("scopes")
            migration_path = '../../../generators/doorkeeper/templates/add_scopes_to_oauth_applications.rb'
            puts "[doorkeeper] Missing column: `oauth_applications.scopes`.
Create the following migration and run `rake db:migrate`.
".squish
            puts File.read(File.expand_path(migration_path, __FILE__))
          end
        end
      end
initialize_application_owner!() click to toggle source
# File lib/doorkeeper/orm/active_record.rb, line 16
def self.initialize_application_owner!
  require 'doorkeeper/models/concerns/ownership'

  Doorkeeper::Application.send :include, Doorkeeper::Models::Ownership
end
initialize_models!() click to toggle source
# File lib/doorkeeper/orm/active_record.rb, line 4
def self.initialize_models!
  require 'doorkeeper/orm/active_record/access_grant'
  require 'doorkeeper/orm/active_record/access_token'
  require 'doorkeeper/orm/active_record/application'

  if Doorkeeper.configuration.active_record_options[:establish_connection]
    [Doorkeeper::AccessGrant, Doorkeeper::AccessToken, Doorkeeper::Application].each do |c|
      c.send :establish_connection, Doorkeeper.configuration.active_record_options[:establish_connection]
    end
  end
end