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:
parent
0eee4f17d3
commit
10610857b4
1 changed files with 6 additions and 12 deletions
|
@ -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?
|
||||
|
|
Loading…
Reference in a new issue