Class: Container

Inherits:
Sequel::Model
  • Object
show all
Includes:
ASModel, Relationships
Defined in:
backend/app/model/container.rb

Instance Attribute Summary

Attributes included from Relationships

#cached_relationships

Class Method Summary (collapse)

Methods included from Relationships

#assimilate, #cache_relationships, included, #my_relationships, #related_records, #transfer_to_repository, #trigger_reindex_of_dependants, #update_from_json

Methods included from ASModel

all_models, included, update_publish_flag, update_suppressed_flag

Methods included from JSONModel

JSONModel, #JSONModel, add_error_handler, all, allow_unmapped_enum_value, backend_url, client_mode?, custom_validations, destroy_model, enum_default_value, enum_values, handle_error, init, load_schema, #models, models, parse_jsonmodel_ref, parse_reference, repository, repository_for, schema_src, set_repository, strict_mode, strict_mode?, with_repository

Class Method Details

+ (Object) handle_delete(ids)



10
11
12
13
14
15
16
17
18
19
20
# File 'backend/app/model/container.rb', line 10

def self.handle_delete(ids)
  # Containers are funny (but not "ha ha" funny) because they're nested
  # records, yet contain relationships with other records.  If we're deleting
  # one of these nested records, we need to clear its relationship as well.

  relationship_defn = find_relationship(:housed_at)
  relationships = relationship_defn.find_by_participant_ids(self, ids)

  relationship_defn.handle_delete(relationships.map(&:id))
  super
end