make update_descendant more readable

This commit is contained in:
Keenan Brock 2019-09-09 16:17:37 -04:00
parent b449ed360d
commit e926876df5
1 changed files with 2 additions and 3 deletions

View File

@ -16,9 +16,8 @@ module Ancestry
unscoped_descendants.each do |descendant|
# ... replace old ancestry with new ancestry
descendant.without_ancestry_callbacks do
descendant.update_attribute(
:ancestor_ids, path_ids + (descendant.ancestor_ids - path_ids_was)
)
new_ancestor_ids = path_ids + (descendant.ancestor_ids - path_ids_was)
descendant.update_attribute(:ancestor_ids, new_ancestor_ids)
end
end
end