From 6e9b333cd541641fa212dd55d1261bc45e982af0 Mon Sep 17 00:00:00 2001 From: f Date: Sun, 11 Apr 2021 16:43:59 -0300 Subject: [PATCH] =?UTF-8?q?permitir=20guardar=20art=C3=ADculos=20con=20cam?= =?UTF-8?q?pos=20de=20solo=20lectura?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/post.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/post.rb b/app/models/post.rb index d0253a7..0123a80 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -378,8 +378,10 @@ class Post # Ejecuta la acción de guardado en cada atributo. def save_attributes! - attributes.map do |attr| - self[attr].writable? && self[attr].save + attributes.select do |attr| + self[attr].writable? + end.map do |attr| + self[attr].save end.all? end end