Sha256: 1924bd393c568e3451b2d21ceeaf7af9ca17897465446955e5ae0f0142bb4c42
Contents?: true
Size: 943 Bytes
Versions: 20
Compression:
Stored size: 943 Bytes
Contents
# This is the parent class of DirectlyContainsAssociation and IndirectlyContainsAssociation module ActiveFedora module Associations class ContainsAssociation < CollectionAssociation #:nodoc: def reader @records ||= ContainerProxy.new(self) end def include?(other) if loaded? target.include?(other) elsif container_predicate = options[:has_member_relation] owner.resource.query(predicate: container_predicate, object: ::RDF::URI(other.uri)).present? else # is_member_of_relation # This will force a load, so it's slowest and the least preferable option target.include?(other) end end protected def count_records load_target.size end def uri raise "Can't get uri. Owner isn't saved" if @owner.new_record? "#{@owner.uri}/#{@reflection.name}" end end end end
Version data entries
20 entries across 20 versions & 1 rubygems