Sha256: bd6cb56aa0b12a6905365d0db905fad0a0b231f8cbd3e48226c022630698cbb5

Contents?: true

Size: 537 Bytes

Versions: 2

Compression:

Stored size: 537 Bytes

Contents

module Doorkeeper
  module Models
    module Ownership
      extend ActiveSupport::Concern

      included do
        belongs_to_options = { polymorphic: true }
        if defined?(ActiveRecord::Base) && ActiveRecord::VERSION::MAJOR >= 5
          belongs_to_options.merge!(optional: true)
        end

        belongs_to :owner, belongs_to_options
        validates :owner, presence: true, if: :validate_owner?
      end

      def validate_owner?
        Doorkeeper.configuration.confirm_application_owner?
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
doorkeeper-4.0.0.rc3 lib/doorkeeper/models/concerns/ownership.rb
doorkeeper-4.0.0.rc2 lib/doorkeeper/models/concerns/ownership.rb