Sha256: 47efdc304b13bc2ff391bfc143c6401d1617ed1f81e70b63a5b0fb701874c235
Contents?: true
Size: 1.04 KB
Versions: 36
Compression:
Stored size: 1.04 KB
Contents
module ActiveFedora module Associations class BasicContainsAssociation < ContainsAssociation #:nodoc: def find_target uris = owner.resource.query(predicate: options[:predicate]) .map { |r| r.object.to_s } uris.map { |object_uri| klass.find(klass.uri_to_id(object_uri)) } end def insert_record(record, force = true, validate = true) record.base_path_for_resource = owner.uri.to_s super end def add_to_target(record, skip_callbacks = false) record.base_path_for_resource = owner.uri.to_s super end def reset # Update the membership triples (and no other triples) on the the owner's resource if owner.persisted? pattern = ::RDF::Query::Pattern.new(predicate: options[:predicate]) new_resource = ActiveFedora::Base.uncached do owner.dup.reload.resource end owner.resource.delete_insert([pattern], new_resource.query(pattern)) end super end end end end
Version data entries
36 entries across 36 versions & 1 rubygems