From 2e2f625dfcf56dd00ae47f9523c0ad470e86e207 Mon Sep 17 00:00:00 2001 From: Kat Date: Mon, 13 Mar 2023 10:30:45 +0000 Subject: [PATCH] Refactor --- app/models/location.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/models/location.rb b/app/models/location.rb index 386bec3f0..7002ce5a9 100644 --- a/app/models/location.rb +++ b/app/models/location.rb @@ -134,8 +134,7 @@ class Location < ApplicationRecord la = LocalAuthority.find_by(code: location_code) return [] unless la - location_local_authorities = [la] + la.linked_local_authorities - LocalAuthority.where(id: location_local_authorities.map(&:id)) + LocalAuthority.where(id: [la.id] + la.linked_local_authority_ids) end private