adds counter cache for assignments
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
class ValuationAssignment < ActiveRecord::Base
|
||||
belongs_to :valuator
|
||||
belongs_to :spending_proposal
|
||||
belongs_to :spending_proposal, counter_cache: true
|
||||
end
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddAssignmentsCounterCacheToSpendingProposal < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :spending_proposals, :valuation_assignments_count, :integer, default: 0
|
||||
end
|
||||
end
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20160224123110) do
|
||||
ActiveRecord::Schema.define(version: 20160225171916) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@@ -308,6 +308,7 @@ ActiveRecord::Schema.define(version: 20160224123110) do
|
||||
t.boolean "valuation_finished", default: false
|
||||
t.text "explanations_log"
|
||||
t.integer "administrator_id"
|
||||
t.integer "valuation_assignments_count", default: 0
|
||||
end
|
||||
|
||||
add_index "spending_proposals", ["author_id"], name: "index_spending_proposals_on_author_id", using: :btree
|
||||
|
||||
Reference in New Issue
Block a user