mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-26 10:36:21 +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
|
private
|
||||||
|
|
||||||
def post_exists?
|
def post_exists?
|
||||||
value.present? && belongs_to.nil?
|
return true if sanitize(value).blank?
|
||||||
|
|
||||||
|
sanitize(value).present? && belongs_to.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def sanitize(uuid)
|
def sanitize(uuid)
|
||||||
|
|
|
@ -73,6 +73,6 @@ class MetadataHasMany < MetadataRelatedPosts
|
||||||
end
|
end
|
||||||
|
|
||||||
def posts_exist?
|
def posts_exist?
|
||||||
has_many.size == value.size
|
has_many.size == sanitize(value).size
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue