Sha256: 5c694ae6a206d9a29248e6b243fe753e9635d414a9220c6946af38b4155e8224

Contents?: true

Size: 652 Bytes

Versions: 43

Compression:

Stored size: 652 Bytes

Contents

module Ddr
  module Governable
    extend ActiveSupport::Concern

    included do
      attribute :admin_policy_id, Valkyrie::Types::ID.optional
     end

    def admin_policy
      if admin_policy_id.present?
        Valkyrie.config.metadata_adapter.query_service.find_by(id: admin_policy_id)
      end
    end

    def admin_policy=(admin_policy)
      unless admin_policy.is_a? Ddr::Collection
        raise ArgumentError,
              I18n.t('ddr.core.errors.incorrect_resource_class',
                     subject: 'Admin Policy', resource_class: 'Ddr::Core::Collection')
      end
      self.admin_policy_id = admin_policy.id
    end

  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
ddr-core-1.6.1 app/models/concerns/ddr/governable.rb
ddr-core-1.6.0 app/models/concerns/ddr/governable.rb
ddr-core-1.5.5 app/models/concerns/ddr/governable.rb
ddr-core-1.5.4 app/models/concerns/ddr/governable.rb
ddr-core-1.5.2 app/models/concerns/ddr/governable.rb
ddr-core-1.5.3 app/models/concerns/ddr/governable.rb
ddr-core-1.5.1 app/models/concerns/ddr/governable.rb
ddr-core-1.4.4 app/models/concerns/ddr/governable.rb
ddr-core-1.4.3 app/models/concerns/ddr/governable.rb
ddr-core-1.4.2 app/models/concerns/ddr/governable.rb
ddr-core-1.4.0 app/models/concerns/ddr/governable.rb
ddr-core-1.3.0 app/models/concerns/ddr/governable.rb
ddr-core-1.2.0 app/models/concerns/ddr/governable.rb
ddr-core-1.2.0.rc3 app/models/concerns/ddr/governable.rb
ddr-core-1.2.0.rc2 app/models/concerns/ddr/governable.rb
ddr-core-1.2.0.rc1 app/models/concerns/ddr/governable.rb
ddr-core-1.1.2 app/models/concerns/ddr/governable.rb
ddr-core-1.1.1 app/models/concerns/ddr/governable.rb
ddr-core-1.1.0 app/models/concerns/ddr/governable.rb
ddr-core-1.0.0 app/models/concerns/ddr/governable.rb