Exception: ActiveFedora::ConstraintError

Inherits:
ActiveFedoraError show all
Defined in:
lib/active_fedora/errors.rb

Overview

Raised when the data has more than one statement for a predicate, but our constraints say it’s singular This helps to prevent overwriting multiple values with a single value when round tripping:

class Book < ActiveFedora::Base
  property :title, predicate: RDF::Vocab::DC.title, multiple: false
end

b = Book.new
b.resource.title = ['foo', 'bar']
b.title # Raises ConstraintError
# which prevents us from doing:
b.title = b.title