From 46bec10aa2c7a0d3f05d71eb6bff90f955f58e1e Mon Sep 17 00:00:00 2001 From: Kara Diaby Date: Wed, 21 Feb 2024 21:53:14 +0000 Subject: [PATCH] lib --- app/lib/recovery/importer.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/lib/recovery/importer.rb b/app/lib/recovery/importer.rb index 0edc4b6a7..836917498 100644 --- a/app/lib/recovery/importer.rb +++ b/app/lib/recovery/importer.rb @@ -112,9 +112,12 @@ module Recovery end end - def import(pj) - ActiveStorage::Blob.insert(pj.blob.attributes) - ActiveStorage::Attachment.insert(pj.attributes) + def import(pjs) + attachments = pjs.respond_to?(:each) ? pjs : [pjs] + attachments.each do |pj| + ActiveStorage::Blob.insert(pj.blob.attributes) + ActiveStorage::Attachment.insert(pj.attributes) + end end end end