mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-26 06:56:22 +00:00
no hace falta cachear, ya lo hace where
This commit is contained in:
parent
1fb53168e2
commit
c9683900dd
1 changed files with 3 additions and 4 deletions
|
@ -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?
|
||||
|
|
Loading…
Reference in a new issue