Sha256: 0a0868794c86f96f74cd3c913d104fc9759b6352c7bc41bc88674b2c7c4dd960

Contents?: true

Size: 612 Bytes

Versions: 3

Compression:

Stored size: 612 Bytes

Contents

# frozen_string_literal: true

module Doorkeeper
  module Orm
    module Concerns
      module Mongoid
        module Ownership
          extend ActiveSupport::Concern

          included do
            belongs_to_options = { polymorphic: true }

            belongs_to_options[:optional] = true if ::Mongoid::VERSION[0].to_i >= 6

            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
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
doorkeeper-mongodb-5.2.2 lib/doorkeeper/orm/concerns/mongoid/ownership.rb
doorkeeper-mongodb-5.2.1 lib/doorkeeper/orm/concerns/mongoid/ownership.rb
doorkeeper-mongodb-5.2.0 lib/doorkeeper/orm/concerns/mongoid/ownership.rb