Sha256: 7b952864f39416af445ae65c30325af938272874c334f7ddfd270c31a6b4e7a8

Contents?: true

Size: 563 Bytes

Versions: 5

Compression:

Stored size: 563 Bytes

Contents

# frozen_string_literal: true

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[: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

5 entries across 5 versions & 1 rubygems

Version Path
doorkeeper-5.0.3 lib/doorkeeper/models/concerns/ownership.rb
doorkeeper-5.1.0.rc2 lib/doorkeeper/models/concerns/ownership.rb
doorkeeper-5.1.0.rc1 lib/doorkeeper/models/concerns/ownership.rb
doorkeeper-5.0.2 lib/doorkeeper/models/concerns/ownership.rb
doorkeeper-5.0.1 lib/doorkeeper/models/concerns/ownership.rb