Skip to content

Commit

Permalink
Merge pull request #11272 from tchak/fix-attachement-destroy
Browse files Browse the repository at this point in the history
fix(attachement): if champ attachement is already destroyed don’t crash
  • Loading branch information
tchak authored Jan 29, 2025
2 parents 0c14bba + d03c14b commit c0fe3c7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/controllers/attachments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ def destroy

if champ?
@attachment = champ.piece_justificative_file.find { _1.blob.id == @blob.id }
@attachment&.purge_later
champ.piece_justificative_file.reload
else
@attachment.purge_later
@attachment_options = attachment_options
end

@attachment.purge_later
@champ.piece_justificative_file.reload if champ?

flash.notice = 'La pièce jointe a bien été supprimée.'

respond_to do |format|
Expand Down

0 comments on commit c0fe3c7

Please sign in to comment.