5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-07-03 13:06:06 +00:00

no hace falta cachear, ya lo hace where

This commit is contained in:
f 2020-11-30 12:13:13 -03:00
parent 1fb53168e2
commit c9683900dd

View file

@ -8,20 +8,19 @@
class MetadataHasMany < MetadataRelatedPosts
# Todos los Post relacionados según la relación remota
def has_many_remote
@has_many_remote ||= posts.where(inverse => post.uuid.value)
posts.where(inverse => post.uuid.value)
end
# Todos los Post relacionados
def has_many
@has_many ||= {}
@has_many[value.hash.to_s] ||= posts.where(uuid: value)
posts.where(uuid: value)
end
# La relación anterior
def had_many
return [] if document.data[name.to_s].blank?
@had_many ||= posts.where(uuid: document.data[name.to_s])
posts.where(uuid: document.data[name.to_s])
end
def inverse?