Class: FindingAidVersion::FindingAidFileValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
app/models/finding_aid_version.rb

Overview

Internal validator class (preferred over validates_each bc YARD can't see validates_each)

Instance Method Summary (collapse)

Instance Method Details

- (Object) validate_each(record, attribute, value)

FindingAidFile exists with digest == value



10
11
12
# File 'app/models/finding_aid_version.rb', line 10

def validate_each(record, attribute, value)
  record.errors.add(attribute, "must be associated with an extant FindingAidFile") unless FindingAidFile[value].is_a? FindingAidFile
end