copy参考答案

dev_forum
daiao 5 years ago
parent 3920568fc7
commit 1b4103a54b

@ -205,7 +205,7 @@ class ShixunsController < ApplicationController
new_challenge.save! new_challenge.save!
# 同步参考答案 # 同步参考答案
challenge.challenge_answers.each do |answer| challenge.challenge_answers.each do |answer|
new_answer = Challenge.new new_answer = ChallengeAnswer.new
new_answer = answer.attributes.dup.except("id","challenge_id") new_answer = answer.attributes.dup.except("id","challenge_id")
new_answer.challenge_id = new_challenge.id new_answer.challenge_id = new_challenge.id
new_answer.save! new_answer.save!

Loading…
Cancel
Save