Merge pull request #1508 from consul/counter_cache_balloting
Ballot_lines counter to investments
This commit is contained in:
@@ -2,7 +2,7 @@ class Budget
|
|||||||
class Ballot
|
class Ballot
|
||||||
class Line < ActiveRecord::Base
|
class Line < ActiveRecord::Base
|
||||||
belongs_to :ballot
|
belongs_to :ballot
|
||||||
belongs_to :investment
|
belongs_to :investment, counter_cache: :ballot_lines_count
|
||||||
belongs_to :heading
|
belongs_to :heading
|
||||||
belongs_to :group
|
belongs_to :group
|
||||||
belongs_to :budget
|
belongs_to :budget
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
class AddBallotLineCountToInvestments < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :budget_investments, :ballot_lines_count, :integer, default: 0
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20170427145845) do
|
ActiveRecord::Schema.define(version: 20170428111355) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
@@ -144,6 +144,7 @@ ActiveRecord::Schema.define(version: 20170427145845) do
|
|||||||
t.string "location"
|
t.string "location"
|
||||||
t.string "organization_name"
|
t.string "organization_name"
|
||||||
t.datetime "unfeasible_email_sent_at"
|
t.datetime "unfeasible_email_sent_at"
|
||||||
|
t.integer "ballot_lines_count", default: 0
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "budget_investments", ["administrator_id"], name: "index_budget_investments_on_administrator_id", using: :btree
|
add_index "budget_investments", ["administrator_id"], name: "index_budget_investments_on_administrator_id", using: :btree
|
||||||
|
|||||||
Reference in New Issue
Block a user