选用题库问题

dev_forum
daiao 6 years ago
parent 2170ea7b7e
commit 0d82cc7a2c

@ -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

Loading…
Cancel
Save