From: Adam Hoyle Date: Wed, 25 Aug 2021 20:03:33 +0000 (+0100) Subject: Reinstate memoisation X-Git-Tag: live~1806^2~38 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/d7a965bf3fcead38e8f376b1bcb56e4f901784d7?ds=sidebyside;hp=--cc Reinstate memoisation --- d7a965bf3fcead38e8f376b1bcb56e4f901784d7 diff --git a/app/models/communities.rb b/app/models/communities.rb index fc2f95800..e63b801fe 100644 --- a/app/models/communities.rb +++ b/app/models/communities.rb @@ -4,14 +4,14 @@ class Communities @local_chapters = {} def self.local_chapters(locale) - @local_chapters[locale] = local_chapter_for(locale) + @local_chapters[locale] ||= local_chapter_for(locale) end class << self protected def local_chapter_for(locale) - @local_chapters_index = load_local_chapters + @local_chapters_index ||= load_local_chapters locale_dict = locale_dict_for(locale) localised_chapters = [] @local_chapters_index.each do |chapter|