From a7c25183100613f95672ac3a1603c02335fcdd9e Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Thu, 5 Dec 2019 13:57:56 +1100 Subject: [PATCH] chore: cache head tag names on the domain object --- lib/pact_broker/pacts/all_pact_publications.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pact_broker/pacts/all_pact_publications.rb b/lib/pact_broker/pacts/all_pact_publications.rb index 4a9d557f3..261eb9292 100644 --- a/lib/pact_broker/pacts/all_pact_publications.rb +++ b/lib/pact_broker/pacts/all_pact_publications.rb @@ -109,7 +109,7 @@ def to_domain_without_tags def head_tag_names # Avoid circular dependency require 'pact_broker/pacts/latest_tagged_pact_publications' - LatestTaggedPactPublications.where(id: id).select(:tag_name).collect{|t| t[:tag_name]} + @head_tag_names ||= LatestTaggedPactPublications.where(id: id).select(:tag_name).collect{|t| t[:tag_name]} end def to_domain_with_content