Sha256: 552c032557fcbbec72095b192101469156a19923cb8198ff999759bba9ae9f62

Contents?: true

Size: 502 Bytes

Versions: 10

Compression:

Stored size: 502 Bytes

Contents

# encoding: UTF-8
class AddDisplayTypeToAnswers < ActiveRecord::Migration
  def self.up
    add_column :answers, :display_type, :string
    Answer.all.each{|a| a.update_attributes(:display_type => "hidden_label") if a.hide_label == true}
    remove_column :answers, :hide_label
  end

  def self.down
    add_column :answers, :hide_label, :boolean
    Answer.all.each{|a| a.update_attributes(:hide_label => true) if a.display_type == "hidden_label"}
    remove_column :answers, :display_type
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
upgrade_surveyor-1.4.2 lib/generators/surveyor/templates/db/migrate/add_display_type_to_answers.rb
hssc_surveyor-1.4.3.pre lib/generators/surveyor/templates/db/migrate/add_display_type_to_answers.rb
hssc_surveyor-1.4.2.pre lib/generators/surveyor/templates/db/migrate/add_display_type_to_answers.rb
hssc_surveyor-1.4.1.pre lib/generators/surveyor/templates/db/migrate/add_display_type_to_answers.rb
surveyor-1.4.0 lib/generators/surveyor/templates/db/migrate/add_display_type_to_answers.rb
surveyor-1.3.0 lib/generators/surveyor/templates/db/migrate/add_display_type_to_answers.rb
surveyor-1.2.0 lib/generators/surveyor/templates/db/migrate/add_display_type_to_answers.rb
surveyor-1.1.0 lib/generators/surveyor/templates/db/migrate/add_display_type_to_answers.rb
surveyor-1.0.1 lib/generators/surveyor/templates/db/migrate/add_display_type_to_answers.rb
surveyor-1.0.0 lib/generators/surveyor/templates/db/migrate/add_display_type_to_answers.rb