diff --git a/app/models/labor_budget_item.rb b/app/models/labor_budget_item.rb index 1aee14fb85..dcc3921ea9 100644 --- a/app/models/labor_budget_item.rb +++ b/app/models/labor_budget_item.rb @@ -42,6 +42,7 @@ class LaborBudgetItem < ActiveRecord::Base scope :visible_costs, lambda{|*args| includes([{ cost_object: :project }, :user]) .where(LaborBudgetItem.visible_condition((args.first || User.current), args[1])) + .references(:projects) } def costs diff --git a/app/models/material_budget_item.rb b/app/models/material_budget_item.rb index b3eeaf452f..d29c4cb5ad 100644 --- a/app/models/material_budget_item.rb +++ b/app/models/material_budget_item.rb @@ -35,6 +35,7 @@ class MaterialBudgetItem < ActiveRecord::Base scope :visible_costs, lambda { |*args| where(MaterialBudgetItem.visible_condition((args.first || User.current), args[1])) .includes(cost_object: :project) + .references(:projects) } def costs