mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-14 17:21:43 +00:00
validar relaciones correctamente
This commit is contained in:
parent
17d0ab6df3
commit
522494de5a
2 changed files with 4 additions and 2 deletions
|
@ -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)
|
||||
|
|
|
@ -73,6 +73,6 @@ class MetadataHasMany < MetadataRelatedPosts
|
|||
end
|
||||
|
||||
def posts_exist?
|
||||
has_many.size == value.size
|
||||
has_many.size == sanitize(value).size
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue