From 595f6805f95d179944cd3609b8bc284ee950d4f1 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 12 Dec 2014 16:28:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=A0=E9=99=A4=E9=99=84?= =?UTF-8?q?=E4=BB=B6=E6=98=AF=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index ecf6fe049..34dfca75f 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -203,7 +203,11 @@ class AttachmentsController < ApplicationController if @attachment.container.respond_to?(:init_journal) @attachment.container.init_journal(User.current) end - @attachment.destroy + if @attachment.container + @attachment.container.attachments.delete(@attachment) + else + @attachment.destroy + end respond_to do |format| if !@attachment.container.nil? &&