5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-23 04:56:22 +00:00

feat: relacionar posts desde su indexación #7537

This commit is contained in:
f 2023-10-06 10:06:28 -03:00
parent ab98119cfe
commit d58cb05c7a
No known key found for this signature in database

View file

@ -67,13 +67,17 @@ class MetadataBelongsTo < MetadataRelatedPosts
end
# El Post relacionado con este artículo
#
# @return [Post,nil]
def belongs_to
posts.find(value, uuid: true) if value.present?
posts.find_by(post_id: value)&.post if value.present?
end
# El artículo relacionado anterior
#
# @return [Post,nil]
def belonged_to
posts.find(value_was, uuid: true) if value_was.present?
posts.find_by(post_id: value_was)&.post if value_was.present?
end
def related_posts?