From bda56e3c1075554b0272f84b1a4b9a8a83bad593 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 13 May 2021 19:47:00 -0300 Subject: [PATCH] =?UTF-8?q?eliminar=20memoizaci=C3=B3n=20en=20las=20b?= =?UTF-8?q?=C3=BAsquedas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/metadata_related_posts.rb | 2 +- app/models/post_relation.rb | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/models/metadata_related_posts.rb b/app/models/metadata_related_posts.rb index 9a73dea..855ea73 100644 --- a/app/models/metadata_related_posts.rb +++ b/app/models/metadata_related_posts.rb @@ -22,7 +22,7 @@ class MetadataRelatedPosts < MetadataArray # Obtiene todos los posts y opcionalmente los filtra def posts - @posts ||= site.posts(lang: lang).where(**filter) + site.posts(lang: lang).where(**filter) end def title(post) diff --git a/app/models/post_relation.rb b/app/models/post_relation.rb index 850a83d..531d3cc 100644 --- a/app/models/post_relation.rb +++ b/app/models/post_relation.rb @@ -93,8 +93,7 @@ class PostRelation < Array def where(**args) return self if args.empty? - @where ||= {} - @where[args.hash.to_s] ||= begin + begin PostRelation.new(site: site, lang: lang).concat(select do |post| result = args.map do |attr, value| next unless post.attribute?(attr)