From d58cb05c7aef36b46f7ff3a1a79803a775f5c688 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 6 Oct 2023 10:06:28 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20relacionar=20posts=20desde=20su=20index?= =?UTF-8?q?aci=C3=B3n=20#7537?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/metadata_belongs_to.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/models/metadata_belongs_to.rb b/app/models/metadata_belongs_to.rb index be1fa670..204d7bed 100644 --- a/app/models/metadata_belongs_to.rb +++ b/app/models/metadata_belongs_to.rb @@ -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?