mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-15 02:31:42 +00:00
eliminar memoización en las búsquedas
This commit is contained in:
parent
38c5cdef81
commit
bda56e3c10
2 changed files with 2 additions and 3 deletions
|
@ -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)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue