diff --git a/app/controllers/collections_controller.rb b/app/controllers/collections_controller.rb index 759807b9..5c871015 100644 --- a/app/controllers/collections_controller.rb +++ b/app/controllers/collections_controller.rb @@ -116,7 +116,8 @@ def destroy notice = "De collectie “#{name}” is verwijderd, de werken zijn verplaatst naar de bovenliggende collectie “#{parent_name}”" end else - @collection.works.destroy_all + @collection.works.find_in_batches(batch_size: 250).map { |a| a.each(&:destroy) } + @collection.collections.each do |collection| collection.parent_collection = nil collection.save