5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-22 21:26:21 +00:00

refactor: guardar las relaciones luego de actualizarlas

(cherry picked from commit 67bb6e45df)
This commit is contained in:
f 2023-10-26 16:31:34 -03:00
parent 0eee4f17d3
commit 10610857b4
No known key found for this signature in database

View file

@ -22,12 +22,6 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do
# Recorrer todas las asociaciones y agregarse donde corresponda
update_associations(post)
associated_posts_to_save.each do |associated_post|
next unless associated_post.save(validate: false)
added_paths << associated_post.path.value
end
commit(action: :created, add: added_paths)
end
@ -67,12 +61,6 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do
# Recorrer todas las asociaciones y agregarse donde corresponda
update_associations(post)
associated_posts_to_save.each do |associated_post|
next unless associated_post.save(validate: false)
added_paths << associated_post.path.value
end
commit(action: :updated, add: added_paths, rm: rm)
end
@ -226,6 +214,12 @@ PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do
when 'locales'
end
end
associated_posts_to_save.each do |associated_post|
next unless associated_post.save(validate: false)
added_paths << associated_post.path.value
end
end
# @todo por qué no podemos usar nil para deshabilitar un valor?