From a23ee99e64afada920db8ffe0568aa84a7affed9 Mon Sep 17 00:00:00 2001 From: yuenmichelle1 Date: Thu, 8 Aug 2024 16:36:35 -0500 Subject: [PATCH] replace deprecated .uniq with .distinct , update test with a secondary board of launched project to ensure distinct projects come out of query result --- app/policies/project_policy.rb | 2 +- spec/policies/project_policy_spec.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb index 588bf5c5..34fafe27 100644 --- a/app/policies/project_policy.rb +++ b/app/policies/project_policy.rb @@ -20,7 +20,7 @@ def resolve .where('private is not true') .joins(:boards) .order(launched_row_order: :desc) - .uniq + .distinct end end end diff --git a/spec/policies/project_policy_spec.rb b/spec/policies/project_policy_spec.rb index 8593661c..82cb7f81 100644 --- a/spec/policies/project_policy_spec.rb +++ b/spec/policies/project_policy_spec.rb @@ -19,6 +19,7 @@ context 'with scope' do let!(:launched1){ create :project, launched_row_order: 1 } let!(:board1){ create :board, section: "project-#{ launched1.id }" } + let!(:second_board_of_launched1){ create :board, section: "project-#{ launched1.id }" } let!(:launched2){ create :project, launched_row_order: 2 } let!(:board2){ create :board, section: "project-#{ launched2.id }" }