Skip to content

Commit

Permalink
Mark content as changed when deleting nodes instead of only when adde…
Browse files Browse the repository at this point in the history
…d because sometimes all values are removed
  • Loading branch information
cjcolvar committed Nov 5, 2024
1 parent 88680da commit e1c6bde
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/models/concerns/media_object_mods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,11 @@ def normalize_desc_metadata!
end

def delete_all_values(*field_name)
# Manually mark the content as changed when deleteing values.
# Adding values causes calls into active_fedora-datastreams which markes the content as changed.
# The ng_xml_will_change! call here covers the case when all values are deleted and none are added back.
# This also markes the content as changed.
descMetadata.ng_xml_will_change!
descMetadata.find_by_terms(*field_name).each &:remove
end
end

0 comments on commit e1c6bde

Please sign in to comment.