From 0dc3a69a93c53eb8a59181503ddb12dca2e5a698 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 26 Oct 2023 16:43:16 -0300 Subject: [PATCH] =?UTF-8?q?fix:=20mantener=20una=20lista=20=C3=BAnica=20de?= =?UTF-8?q?=20archivos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/post_service.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/services/post_service.rb b/app/services/post_service.rb index da7673d0..6c10b044 100644 --- a/app/services/post_service.rb +++ b/app/services/post_service.rb @@ -16,7 +16,6 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do end if post.update(post_params) - added_paths = [] added_paths << post.path.value # Recorrer todas las asociaciones y agregarse donde corresponda @@ -55,7 +54,6 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do rm = [] rm << post.path.value_was if post.path.changed? - added_paths = [] added_paths << post.path.value # Recorrer todas las asociaciones y agregarse donde corresponda @@ -148,11 +146,16 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do end end - # @return [Array] + # @return [Set] def associated_posts_to_save @associated_posts_to_save ||= Set.new end + # @return [Set] + def added_paths + @added_paths ||= Set.new + end + # Recolectar campos asociados que no estén vacíos # # @param [Post]