Class: ActiveFedora::Associations::ContainsAssociation
- Inherits:
-
CollectionAssociation
- Object
- Association
- CollectionAssociation
- ActiveFedora::Associations::ContainsAssociation
- Defined in:
- lib/active_fedora/associations/contains_association.rb
Overview
:nodoc:
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from CollectionAssociation
Attributes inherited from Association
#inversed, #owner, #reflection, #target
Instance Method Summary collapse
Methods inherited from CollectionAssociation
#add_to_target, #any?, #build, #concat, #concat_records, #count, #create, #create!, #delete, #delete_all, #destroy, #destroy_all, #empty?, #find, #first, #ids_reader, #ids_writer, #last, #load_from_solr, #load_target, #null_scope?, #replace, #reset, #scope, #select, #size, #target=, #to_ary, #writer
Methods inherited from Association
#association_scope, #initialize, #initialize_attributes, #load_target, #loaded!, #loaded?, #reload, #reset, #scope, #set_inverse_instance, #stale_target?, #target_scope
Constructor Details
This class inherits a constructor from ActiveFedora::Associations::Association
Instance Method Details
#include?(other) ⇒ Boolean
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/active_fedora/associations/contains_association.rb', line 9 def include?(other) if loaded? target.include?(other) elsif container_predicate = [: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 |
#reader ⇒ Object
5 6 7 |
# File 'lib/active_fedora/associations/contains_association.rb', line 5 def reader @records ||= ContainerProxy.new(self) end |