Class: UpdateBlankVersionsOnSurveys

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/surveyor/templates/db/migrate/update_blank_versions_on_surveys.rb

Class Method Summary collapse

Class Method Details

.downObject



11
12
# File 'lib/generators/surveyor/templates/db/migrate/update_blank_versions_on_surveys.rb', line 11

def self.down
end

.upObject



4
5
6
7
8
9
# File 'lib/generators/surveyor/templates/db/migrate/update_blank_versions_on_surveys.rb', line 4

def self.up
  Survey.where('survey_version IS ?', nil).each do |s|
    s.survey_version = 0
    s.save!
  end
end