Skip to content

Commit

Permalink
use the GlobalID library tooling to determine global id (#869)
Browse files Browse the repository at this point in the history
the old `#gid` method was weird and breaking for users expecting things to work
with `GlobalID` tools: samvera/hyrax#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.
  • Loading branch information
tamsin johnson authored Oct 17, 2023
1 parent 9968414 commit 75e3d26
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/factories/bulkrax/object_factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion app/models/bulkrax/csv_collection_entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion app/parsers/bulkrax/oai_dc_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 75e3d26

Please sign in to comment.