You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/db/migrate/20190820102040_change_exerc...

17 lines
452 B

class ChangeExercise1930Position < ActiveRecord::Migration[5.2]
def change
#正式版的1930试卷的位置出现问题
#
ex = Exercise.find_by(id:1930)
ex.exercise_questions.each_with_index do |q,index|
q.update_attributes(question_number:index+1)
end
ex_q_bank = ex.exercise_bank.exercise_bank_questions
ex_q_bank.each_with_index do |q,index|
q.update_attributes(question_number:index+1)
end
end
end