mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-23 01:36:22 +00:00
refactor: guardar las relaciones luego de actualizarlas
This commit is contained in:
parent
66472d4b6f
commit
67bb6e45df
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