mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-26 21:06:21 +00:00
feat: relacionar posts desde su indexación #7537
This commit is contained in:
parent
ab98119cfe
commit
d58cb05c7a
1 changed files with 6 additions and 2 deletions
|
@ -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?
|
||||
|
|
Loading…
Reference in a new issue