5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-07-06 00:15:46 +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 class MetadataHasMany < MetadataRelatedPosts
# Todos los Post relacionados según la relación remota # Todos los Post relacionados según la relación remota
def has_many_remote def has_many_remote
@has_many_remote ||= posts.where(inverse => post.uuid.value) posts.where(inverse => post.uuid.value)
end end
# Todos los Post relacionados # Todos los Post relacionados
def has_many def has_many
@has_many ||= {} posts.where(uuid: value)
@has_many[value.hash.to_s] ||= posts.where(uuid: value)
end end
# La relación anterior # La relación anterior
def had_many def had_many
return [] if document.data[name.to_s].blank? 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 end
def inverse? def inverse?