From 75e3d2633389420bbf57723588e87844d8ce37ad Mon Sep 17 00:00:00 2001 From: tamsin johnson Date: Tue, 17 Oct 2023 07:20:30 -0700 Subject: [PATCH] use the `GlobalID` library tooling to determine global id (#869) the old `#gid` method was weird and breaking for users expecting things to work with `GlobalID` tools: https://github.com/samvera/hyrax/issues/4696 Hyrax has provided a mechanism for updating "gid" references since the 3.0 line, and will drop `#gid` in 5.0.0. use `#to_global_id` to get global ids instead. --- app/factories/bulkrax/object_factory.rb | 2 +- app/models/bulkrax/csv_collection_entry.rb | 2 +- app/parsers/bulkrax/oai_dc_parser.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/factories/bulkrax/object_factory.rb b/app/factories/bulkrax/object_factory.rb index 9e9e8ee6..dd5d3770 100644 --- a/app/factories/bulkrax/object_factory.rb +++ b/app/factories/bulkrax/object_factory.rb @@ -253,7 +253,7 @@ def clean_attrs(attrs) def collection_type(attrs) return attrs if attrs['collection_type_gid'].present? - attrs['collection_type_gid'] = Hyrax::CollectionType.find_or_create_default_collection_type.gid + attrs['collection_type_gid'] = Hyrax::CollectionType.find_or_create_default_collection_type.to_global_id.to_s attrs end diff --git a/app/models/bulkrax/csv_collection_entry.rb b/app/models/bulkrax/csv_collection_entry.rb index c62f46dd..ea6df632 100644 --- a/app/models/bulkrax/csv_collection_entry.rb +++ b/app/models/bulkrax/csv_collection_entry.rb @@ -15,7 +15,7 @@ def add_identifier def add_collection_type_gid return if self.parsed_metadata['collection_type_gid'].present? - self.parsed_metadata['collection_type_gid'] = ::Hyrax::CollectionType.find_or_create_default_collection_type.gid + self.parsed_metadata['collection_type_gid'] = ::Hyrax::CollectionType.find_or_create_default_collection_type.to_global_id.to_s end end end diff --git a/app/parsers/bulkrax/oai_dc_parser.rb b/app/parsers/bulkrax/oai_dc_parser.rb index 4116ac52..4319ab3f 100644 --- a/app/parsers/bulkrax/oai_dc_parser.rb +++ b/app/parsers/bulkrax/oai_dc_parser.rb @@ -67,7 +67,7 @@ def create_collections metadata = { visibility: 'open' } - metadata[:collection_type_gid] = Hyrax::CollectionType.find_or_create_default_collection_type.gid if defined?(::Hyrax) + metadata[:collection_type_gid] = Hyrax::CollectionType.find_or_create_default_collection_type.to_global_id.to_s if defined?(::Hyrax) collections.each_with_index do |set, index| next unless collection_name == 'all' || collection_name == set.spec