diff --git a/app/models/labor_budget_item.rb b/app/models/labor_budget_item.rb index ca94a2498f..1aee14fb85 100644 --- a/app/models/labor_budget_item.rb +++ b/app/models/labor_budget_item.rb @@ -40,9 +40,8 @@ class LaborBudgetItem < ActiveRecord::Base end scope :visible_costs, lambda{|*args| - { include: [{ cost_object: :project }, :user], - conditions: LaborBudgetItem.visible_condition((args.first || User.current), args[1]) - } + includes([{ cost_object: :project }, :user]) + .where(LaborBudgetItem.visible_condition((args.first || User.current), args[1])) } def costs diff --git a/lib/open_project/costs/patches/time_entry_patch.rb b/lib/open_project/costs/patches/time_entry_patch.rb index 2220e30604..cae29dbd0f 100644 --- a/lib/open_project/costs/patches/time_entry_patch.rb +++ b/lib/open_project/costs/patches/time_entry_patch.rb @@ -50,9 +50,8 @@ module OpenProject::Costs::Patches::TimeEntryPatch (#{Project.allowed_to_condition(user, :view_own_hourly_rate, project: project)} AND #{TimeEntry.table_name}.user_id = #{user.id})) } view_time_entries = TimeEntry.visible_condition(user, project) - { include: [:project, :user], - conditions: [view_time_entries, view_hourly_rates].join(' AND ') - } + includes(:project, :user) + .where([view_time_entries, view_hourly_rates].join(' AND ')) } end end