Add ballot_lines_count counter_cache to ballot -> ballot line relationship
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
class Budget
|
||||
class Ballot
|
||||
class Line < ApplicationRecord
|
||||
belongs_to :ballot
|
||||
belongs_to :ballot, counter_cache: :ballot_lines_count
|
||||
belongs_to :investment, counter_cache: :ballot_lines_count
|
||||
belongs_to :heading
|
||||
belongs_to :group
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddBallotLineCounterCachedToBudgetBallots < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :budget_ballots, :ballot_lines_count, :integer, default: 0
|
||||
end
|
||||
end
|
||||
@@ -131,9 +131,10 @@ ActiveRecord::Schema.define(version: 20190411090023) do
|
||||
create_table "budget_ballots", force: :cascade do |t|
|
||||
t.integer "user_id"
|
||||
t.integer "budget_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.boolean "physical", default: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.integer "ballot_lines_count", default: 0
|
||||
t.boolean "physical", default: false
|
||||
t.integer "poll_ballot_id"
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user