With these classes:
class CodexMetadata < ActiveFedora::OmDatastream
set_terminology do |t|
t.root(path: "fields")
t.title
t.author
end
def self.xml_template
Nokogiri::XML.parse("<fields/>")
end
end
class Codex < ActiveFedora::Base
contains 'descMetadata', class_name: 'CodexMetadata'
property :title, datastream: 'descMetadata', multiple: false do |index|
index.as :stored_searchable
end
property :author, datastream: 'descMetadata', multiple: false do |index|
index.as :stored_searchable
end
end
When I try to create a new object:
c = Codex.create(id: 'test-3', title: 'On the Equilibrium of Planes', author: 'Archimedes of Syracuse')
I get the following error
ArgumentError: You attempted to set the attribute `title' on `Codex' to a scalar value. However, this attribute is declared as being multivalued.
If I do this, I don't get the same error
property :title, predicate: ::RDF::DC.title, multiple: false do |index|