class Hydra::PCDM::Validators::AncestorValidator

Attributes

owner[R]
record[R]

Public Class Methods

new(owner, record) click to toggle source
# File lib/hydra/pcdm/validators/ancestor_validator.rb, line 8
def initialize(owner, record)
  @owner = owner
  @record = record
end
validate!(association, record) click to toggle source
# File lib/hydra/pcdm/validators/ancestor_validator.rb, line 3
def self.validate!(association, record)
  new(association.owner, record).validate!
end

Public Instance Methods

validate!() click to toggle source
# File lib/hydra/pcdm/validators/ancestor_validator.rb, line 13
def validate!
  return unless owner.ancestor?(record)
  raise ArgumentError, "#{record.class} with ID: #{record.id} failed to pass AncestorChecker validation"
end