From 9650e54987b42d1b957b19711d66b305f64c5c35 Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 12 Jul 2018 09:16:58 +0100 Subject: [PATCH] Restore callbacks --- lib/importer/factory/object_factory.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/importer/factory/object_factory.rb b/lib/importer/factory/object_factory.rb index bdbcabfa0..75c99ec07 100644 --- a/lib/importer/factory/object_factory.rb +++ b/lib/importer/factory/object_factory.rb @@ -30,7 +30,9 @@ def run def update raise "Object doesn't exist" unless object @attr = update_attributes - work_actor.update(environment(@attr)) + run_callbacks(:save) do + work_actor.update(environment(@attr)) + end destroy_existing_file_set if object.file_sets.present? attach_file_to_work log_updated(object) @@ -67,7 +69,11 @@ def search_by_identifier def create @attr = create_attributes @object = klass.new - klass == Collection ? create_collection(@attr) : work_actor.create(environment(@attr)) + run_callbacks :save do + run_callbacks :create do + klass == Collection ? create_collection(@attr) : work_actor.create(environment(@attr)) + end + end attach_file_to_work log_created(object) end