app/models/generic_file.rb
class GenericFile < ActiveFedora::Base
has_metadata 'descMetadata', type: MediaAnnotationDatastream
has_attributes :title_attributes, datastream: 'descMetadata', multiple: true
attr_accessible :title_attributes # <== needs to be changed to use strong params, yes?
end
app/models/datastream/media_annotation_datastream.rb
class MediaAnnotationDatastream < RDF::EbuCore::Datastream
property :title, predicate: RDF::EbuCore::Vocabulary.title, class_name: Title
accepts_nested_attributes_for :title
end
and the offending test line looks something like this...
generic_file = GenericFile.find(generic_file_id)
attributes = {
"title_attrributes" => [
{"title_type" => "Series", "value" => "Sesame Street"},
{"title_type" => "Program", "value" => "Cookie Did It All for the Nookie"}
]
}
# Here is the line that triggers the error
generic_file.attributes = attributes
... and produces this error...
NoMethodError: undefined method `title_attributes' for #<MediaAnnotationDatastream:0x007fdcaf7a44d0>