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.
11 lines
352 B
11 lines
352 B
6 years ago
|
class AddAnswerForChallengeAnswer < ActiveRecord::Migration[5.2]
|
||
|
def change
|
||
|
challenges = Challenge.where("answer is not null")
|
||
|
challenges.find_each do |c|
|
||
|
puts "####################{c.id}"
|
||
|
ChallengeAnswer.create(name: "解题代码", contents: "#{c.answer}", level: 1, score: 100, challenge_id: c.id)
|
||
|
end
|
||
|
|
||
|
end
|
||
|
end
|