Module: Hyrax::V2GraphIndexer::NestedCollectionPersistenceServiceDecorator::ClassMethods

Defined in:
lib/hyrax/v2_graph_indexer.rb

Overview

These overrides are needed because nothing in the 2.9.x implementation was explicitly saving the collection membership changes; they were being indexed but not saved. It’s possible the indexing service was saving the objects.

Instance Method Summary collapse

Instance Method Details

#persist_nested_collection_for(parent:, child:) ⇒ Object



113
114
115
116
# File 'lib/hyrax/v2_graph_indexer.rb', line 113

def persist_nested_collection_for(parent:, child:)
  child.member_of_collections.push(parent)
  child.save
end

#remove_nested_relationship_for(parent:, child:) ⇒ Object



118
119
120
121
122
# File 'lib/hyrax/v2_graph_indexer.rb', line 118

def remove_nested_relationship_for(parent:, child:)
  child.member_of_collections.delete(parent)
  child.save
  true
end