From de995573139b01a315ddf766614de4a4da8e183f Mon Sep 17 00:00:00 2001 From: John Pinto Date: Wed, 1 Sep 2021 16:57:24 +0100 Subject: [PATCH] Issue #496 - Plan search issues. Changes: - Replaced .where(Role.creator_condition) with .where(roles: { active: true }) in model Plan search scope. --- app/models/plan.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/plan.rb b/app/models/plan.rb index a5fe102007..718bf9810d 100644 --- a/app/models/plan.rb +++ b/app/models/plan.rb @@ -169,13 +169,13 @@ class Plan < ApplicationRecord scope :search, lambda { |term| if date_range?(term: term) joins(:template, roles: [user: :org]) - .where(Role.creator_condition) + .where(roles: { active: true }) .by_date_range(:created_at, term) else search_pattern = "%#{term}%" joins(:template, roles: [user: :org]) .left_outer_joins(:identifiers, :contributors) - .where(Role.creator_condition) + .where(roles: { active: true }) .where("lower(plans.title) LIKE lower(:search_pattern) OR lower(orgs.name) LIKE lower (:search_pattern) OR lower(orgs.abbreviation) LIKE lower (:search_pattern)