Class: UpdateBlankApiIdsOnQuestionGroup
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- UpdateBlankApiIdsOnQuestionGroup
- Defined in:
- lib/generators/surveyor/templates/db/migrate/update_blank_api_ids_on_question_group.rb
Class Method Summary collapse
Class Method Details
.down ⇒ Object
20 21 |
# File 'lib/generators/surveyor/templates/db/migrate/update_blank_api_ids_on_question_group.rb', line 20 def self.down end |
.up ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/generators/surveyor/templates/db/migrate/update_blank_api_ids_on_question_group.rb', line 10 def self.up check = [Survey, Question, QuestionGroup, Answer, Response, ResponseSet] check.each do |clazz| clazz.where('api_id IS ?', nil).each do |c| c.api_id = Surveyor::Common.generate_api_id c.save! end end end |