From 6e1baf7643ea56b6906f5d4713c385f015e77e75 Mon Sep 17 00:00:00 2001 From: Pius Uzamere Date: Fri, 4 Dec 2009 10:17:00 -0500 Subject: [PATCH] include generic prompts_count for choices --- db/migrate/20091204151448_add_prompts_count_to_choices.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+), 0 deletions(-) create mode 100644 db/migrate/20091204151448_add_prompts_count_to_choices.rb diff --git a/db/migrate/20091204151448_add_prompts_count_to_choices.rb b/db/migrate/20091204151448_add_prompts_count_to_choices.rb new file mode 100644 index 0000000..75a9c2d --- /dev/null +++ b/db/migrate/20091204151448_add_prompts_count_to_choices.rb @@ -0,0 +1,14 @@ +class AddPromptsCountToChoices < ActiveRecord::Migration + def self.up + add_column :choices, :prompts_count, :integer, :default => 0 + + Choice.reset_column_information + Choice.find(:all).each do |c| + Choice.update_counters c.id, :prompts_count => c.prompts_on_the_left_count + c.prompts_on_the_right_count + end + end + + def self.down + remove_column :choices, :prompts_count + end +end -- libgit2 0.21.2