Class: Hyrax::CollectionsMigration
- Inherits:
-
Object
- Object
- Hyrax::CollectionsMigration
- Defined in:
- lib/hyrax/collections_migration.rb
Class Method Summary collapse
Class Method Details
.run ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/hyrax/collections_migration.rb', line 3 def self.run ::Collection.all.each do |collection| collection.members.each do |member| member.member_of_collections << collection unless member.save raise "Work #{member.id} failed to save after recording its membership in collection #{collection.id}" end end collection.members = [] unless collection.save raise "Collection #{collection.id} failed to save after emptying its member list" end end end |