Class: Collavre::AttachmentsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Collavre::AttachmentsController
- Defined in:
- app/controllers/collavre/attachments_controller.rb
Instance Method Summary collapse
-
#destroy ⇒ Object
DELETE /attachments/:signed_id.
Instance Method Details
#destroy ⇒ Object
DELETE /attachments/:signed_id
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/collavre/attachments_controller.rb', line 4 def destroy blob = ActiveStorage::Blob.find_signed(params[:signed_id]) unless (blob) return head :forbidden end blob.purge head :no_content rescue ActiveRecord::RecordNotFound head :not_found rescue StandardError => e Rails.logger.error("Failed to delete attachment: #{e.}") head :internal_server_error end |