Commit 6e1baf7643ea56b6906f5d4713c385f015e77e75
1 parent
1c73a0c6
Exists in
master
and in
1 other branch
include generic prompts_count for choices
Showing
1 changed file
with
14 additions
and
0 deletions
Show diff stats
db/migrate/20091204151448_add_prompts_count_to_choices.rb
0 → 100644
@@ -0,0 +1,14 @@ | @@ -0,0 +1,14 @@ | ||
1 | +class AddPromptsCountToChoices < ActiveRecord::Migration | ||
2 | + def self.up | ||
3 | + add_column :choices, :prompts_count, :integer, :default => 0 | ||
4 | + | ||
5 | + Choice.reset_column_information | ||
6 | + Choice.find(:all).each do |c| | ||
7 | + Choice.update_counters c.id, :prompts_count => c.prompts_on_the_left_count + c.prompts_on_the_right_count | ||
8 | + end | ||
9 | + end | ||
10 | + | ||
11 | + def self.down | ||
12 | + remove_column :choices, :prompts_count | ||
13 | + end | ||
14 | +end |