5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-15 02:11:42 +00:00

eliminar memoización en las búsquedas

This commit is contained in:
f 2021-05-13 19:47:00 -03:00
parent 38c5cdef81
commit bda56e3c10
2 changed files with 2 additions and 3 deletions

View file

@ -22,7 +22,7 @@ class MetadataRelatedPosts < MetadataArray
# Obtiene todos los posts y opcionalmente los filtra # Obtiene todos los posts y opcionalmente los filtra
def posts def posts
@posts ||= site.posts(lang: lang).where(**filter) site.posts(lang: lang).where(**filter)
end end
def title(post) def title(post)

View file

@ -93,8 +93,7 @@ class PostRelation < Array
def where(**args) def where(**args)
return self if args.empty? return self if args.empty?
@where ||= {} begin
@where[args.hash.to_s] ||= begin
PostRelation.new(site: site, lang: lang).concat(select do |post| PostRelation.new(site: site, lang: lang).concat(select do |post|
result = args.map do |attr, value| result = args.map do |attr, value|
next unless post.attribute?(attr) next unless post.attribute?(attr)