From 0d82cc7a2c4b3559f99b502be0740e06a4912335 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 23 Jul 2019 21:22:19 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=89=E7=94=A8=E9=A2=98=E5=BA=93=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/question_banks_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/question_banks_controller.rb b/app/controllers/question_banks_controller.rb index e30065d09..8f295fa95 100644 --- a/app/controllers/question_banks_controller.rb +++ b/app/controllers/question_banks_controller.rb @@ -147,15 +147,17 @@ class QuestionBanksController < ApplicationController new_homework.homework_detail_group.base_on_project = homework.base_on_project end # 附件 + logger.info("######attachments: #{homework.attachments.count}") homework.attachments.try(:each) do |attachment| att = attachment.copy att.container_id = nil att.container_type = nil att.author_id = homework.user_id att.copy_from = attachment.id - att.save + att.save! new_homework.attachments << att end + logger.info("######new_homework.attachments: #{new_homework.attachments.count}") if new_homework.save new_homework_detail_manual.save if new_homework_detail_manual