From 0c0be4de1c0bbd9e8edab747b975a19bf0056c4b Mon Sep 17 00:00:00 2001 From: Mason Ballengee Date: Mon, 8 Jul 2024 11:52:52 -0400 Subject: [PATCH] Use update_index instead of save when updating We need to trigger an update of the parent object's index when updating Supplemental Files. This can be done more cleanly by using `update_index` method instead of saving the parent object. --- app/controllers/supplemental_files_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/supplemental_files_controller.rb b/app/controllers/supplemental_files_controller.rb index b1e263c499..27b4bebcdd 100644 --- a/app/controllers/supplemental_files_controller.rb +++ b/app/controllers/supplemental_files_controller.rb @@ -110,7 +110,8 @@ def update @supplemental_file.attach_file(attachment) if attachment raise Avalon::SaveError, @supplemental_file.errors.full_messages unless @supplemental_file.save - raise Avalon::SaveError, @object.errors[:supplemental_files_json] unless @object.save + # Updates parent object's solr document + @object.update_index flash[:success] = "Supplemental file successfully updated." respond_to do |format|