Sha256: 89d3b59ffb28cb72689ffebb9bda151118cc294511202512a4ed224a1302a8d3

Contents?: true

Size: 666 Bytes

Versions: 15

Compression:

Stored size: 666 Bytes

Contents

# frozen_string_literal: true
namespace :hyrax do
  namespace :collections do
    desc 'Update CollectionType global id references for Hyrax 3.0.0'
    task update_collection_type_global_ids: :environment do
      puts 'Updating collection -> collection type GlobalId references.'

      count = 0

      Collection.all.each do |collection|
        next if collection.collection_type_gid == collection.collection_type.to_global_id.to_s

        collection.public_send(:collection_type_gid=, collection.collection_type.to_global_id, force: true)

        collection.save &&
          count += 1
      end

      puts "Updated #{count} collections."
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
hyrax-5.0.0.rc1 lib/tasks/collection_type_global_id.rake
hyrax-3.6.0 lib/tasks/collection_type_global_id.rake
hyrax-4.0.0 lib/tasks/collection_type_global_id.rake
hyrax-4.0.0.rc3 lib/tasks/collection_type_global_id.rake
hyrax-4.0.0.rc2 lib/tasks/collection_type_global_id.rake
hyrax-4.0.0.rc1 lib/tasks/collection_type_global_id.rake
hyrax-3.5.0 lib/tasks/collection_type_global_id.rake
hyrax-4.0.0.beta2 lib/tasks/collection_type_global_id.rake
hyrax-3.4.2 lib/tasks/collection_type_global_id.rake
hyrax-4.0.0.beta1 lib/tasks/collection_type_global_id.rake
hyrax-3.4.1 lib/tasks/collection_type_global_id.rake
hyrax-3.4.0 lib/tasks/collection_type_global_id.rake
hyrax-3.3.0 lib/tasks/collection_type_global_id.rake
hyrax-3.2.0 lib/tasks/collection_type_global_id.rake
hyrax-3.1.0 lib/tasks/collection_type_global_id.rake