Skip to content
Snippets Groups Projects
Commit c60bcca5 authored by Marcela Ribeiro de Oliveira's avatar Marcela Ribeiro de Oliveira
Browse files

delete attachment from learning_object.attachments

parent f133b6a6
No related branches found
No related tags found
No related merge requests found
......@@ -36,6 +36,7 @@ class V1::LearningObjects::AttachmentController < ApplicationController
return render status: :not_found if @learning_object.nil? || @attachment.nil?
DeleteBitstreamWorker.perform_async(@attachment.id)
@learning_object.attachments.delete(@attachment)
if @learning_object.attachment == @attachment
@learning_object.attachment = nil
@learning_object.save
......@@ -43,6 +44,7 @@ class V1::LearningObjects::AttachmentController < ApplicationController
@learning_object.reload
@learning_object.default_attachment
else
@learning_object.save
@attachment.destroy
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment