Sha256: db86fad8a06579a9723692ea877468ece48f8a8090bad012245db6a95888b10b

Contents?: true

Size: 324 Bytes

Versions: 4

Compression:

Stored size: 324 Bytes

Contents

require 'active_model'

module LinkedVocabs::Validators
  class AuthorityValidator < ActiveModel::Validator
    def validate(record)
      unless record.in_vocab?
        record.errors.add :base, "#{record.rdf_subject.to_s} is not a term in a controlled vocabulary #{record.class.vocabularies}" 
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
linked_vocabs-0.3.1 lib/linked_vocabs/validators/authority_validator.rb
linked_vocabs-0.3.0 lib/linked_vocabs/validators/authority_validator.rb
linked_vocabs-0.2.0 lib/linked_vocabs/validators/authority_validator.rb
linked_vocabs-0.1.0 lib/linked_vocabs/validators/authority_validator.rb