复制功能

dev_home
daiao 5 years ago
parent 65c4eacf6f
commit a88ca6e8f9

@ -177,7 +177,7 @@ class Subjects::CopySubjectService < ApplicationService
def copy_challenge_questions_data!(challenge_choose, to_challenge_choose) def copy_challenge_questions_data!(challenge_choose, to_challenge_choose)
challenge_choose.challenge_questions.each do |challenge_question| challenge_choose.challenge_questions.each do |challenge_question|
to_challenge_question = to_challenge_choose.challenge_questions.new to_challenge_question = to_challenge_choose.challenge_questions.new
to_challenge_question.attributes = challenge_question.attributes.dup.except('id,', 'challenge_choose_id') to_challenge_question.attributes = challenge_question.attributes.dup.except('id', 'challenge_choose_id')
to_challenge_question.challenge_choose_id = to_challenge_choose.id to_challenge_question.challenge_choose_id = to_challenge_choose.id
to_challenge_question.save! to_challenge_question.save!
end end

Loading…
Cancel
Save