Class: AddDisplayTypeToAnswers
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- AddDisplayTypeToAnswers
- Defined in:
- lib/generators/surveyor/templates/db/migrate/add_display_type_to_answers.rb
Class Method Summary collapse
Class Method Details
.down ⇒ Object
9 10 11 12 13 |
# File 'lib/generators/surveyor/templates/db/migrate/add_display_type_to_answers.rb', line 9 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 |
.up ⇒ Object
3 4 5 6 7 |
# File 'lib/generators/surveyor/templates/db/migrate/add_display_type_to_answers.rb', line 3 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 |