validar relaciones correctamente

This commit is contained in:
f 2021-02-11 17:57:12 -03:00
parent 17d0ab6df3
commit 522494de5a
2 changed files with 4 additions and 2 deletions

View file

@ -90,7 +90,9 @@ class MetadataBelongsTo < MetadataRelatedPosts
private
def post_exists?
value.present? && belongs_to.nil?
return true if sanitize(value).blank?
sanitize(value).present? && belongs_to.present?
end
def sanitize(uuid)

View file

@ -73,6 +73,6 @@ class MetadataHasMany < MetadataRelatedPosts
end
def posts_exist?
has_many.size == value.size
has_many.size == sanitize(value).size
end
end