From a9ee06f1a350526f29d91f4880ddbdbeb364046d Mon Sep 17 00:00:00 2001 From: f Date: Tue, 26 May 2020 16:43:20 -0300 Subject: [PATCH] =?UTF-8?q?no=20fallar=20si=20el=20art=C3=ADculo=20no=20ti?= =?UTF-8?q?ene=20orden?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/post_relation.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/models/post_relation.rb b/app/models/post_relation.rb index e262893d..10712342 100644 --- a/app/models/post_relation.rb +++ b/app/models/post_relation.rb @@ -43,9 +43,11 @@ class PostRelation < Array attrs.map do |attr| # TODO: detectar el tipo de atributo faltante y obtener el valor # por defecto para hacer la comparaciĆ³n - return 0 unless post.attributes.include? attr - - post.public_send(attr).value + if post.attributes.include? attr + post.public_send(attr).value + else + 0 + end end end end