Sha256: b99757d39ec384906718ad780e6d984c73acecd63541d512405ace82329a4c59

Contents?: true

Size: 532 Bytes

Versions: 16

Compression:

Stored size: 532 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[: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

16 entries across 16 versions & 1 rubygems

Version Path
doorkeeper-4.4.3 lib/doorkeeper/models/concerns/ownership.rb
doorkeeper-5.0.0 lib/doorkeeper/models/concerns/ownership.rb
doorkeeper-4.4.2 lib/doorkeeper/models/concerns/ownership.rb
doorkeeper-4.4.1 lib/doorkeeper/models/concerns/ownership.rb
doorkeeper-5.0.0.rc2 lib/doorkeeper/models/concerns/ownership.rb
doorkeeper-4.4.0 lib/doorkeeper/models/concerns/ownership.rb
doorkeeper-5.0.0.rc1 lib/doorkeeper/models/concerns/ownership.rb
doorkeeper-4.3.2 lib/doorkeeper/models/concerns/ownership.rb
doorkeeper-4.3.1 lib/doorkeeper/models/concerns/ownership.rb
doorkeeper-4.3.0 lib/doorkeeper/models/concerns/ownership.rb
doorkeeper-4.2.6 lib/doorkeeper/models/concerns/ownership.rb
doorkeeper-4.2.5 lib/doorkeeper/models/concerns/ownership.rb
doorkeeper-4.2.0 lib/doorkeeper/models/concerns/ownership.rb
doorkeeper-4.1.0 lib/doorkeeper/models/concerns/ownership.rb
doorkeeper-4.0.0 lib/doorkeeper/models/concerns/ownership.rb
doorkeeper-4.0.0.rc4 lib/doorkeeper/models/concerns/ownership.rb