From 9ed22fb065d9c7367429b9034e298d6a9b4e0774 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 10 Apr 2023 18:06:01 -0300 Subject: [PATCH] =?UTF-8?q?fix:=20verificar=20que=20haya=20una=20relaci?= =?UTF-8?q?=C3=B3n=20#13005?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/metadata_belongs_to.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/models/metadata_belongs_to.rb b/app/models/metadata_belongs_to.rb index 8726f1b1..17ecaee8 100644 --- a/app/models/metadata_belongs_to.rb +++ b/app/models/metadata_belongs_to.rb @@ -50,10 +50,12 @@ class MetadataBelongsTo < MetadataRelatedPosts end # No duplicar las relaciones - if belongs_to[inverse].respond_to? :has_one - belongs_to[inverse].value = post.uuid.value - else - belongs_to[inverse].value = (belongs_to[inverse].value.dup << post.uuid.value) unless belongs_to.blank? || included? + if belongs_to.present? + if belongs_to[inverse].respond_to? :has_one + belongs_to[inverse].value = post.uuid.value + else + belongs_to[inverse].value = (belongs_to[inverse].value.dup << post.uuid.value) unless belongs_to.blank? || included? + end end true