Skip to content

Commit

Permalink
Use update_index instead of save when updating
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
masaball committed Jul 8, 2024
1 parent 6e0e122 commit 0c0be4d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/controllers/supplemental_files_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down

0 comments on commit 0c0be4d

Please sign in to comment.