def update_children_paths
      self.class.where(
        ["#{self.class.table_name}.parents_path <@ :old_path AND #{self.class.table_name}.id != :id", old_path: parents_path_before_last_save, id: id]
      ).update_all(
        ["parents_path = :new_path || subpath(parents_path, nlevel(:old_path))", new_path: parents_path, old_path: parents_path_before_last_save]
      )
    end
def update_children_paths
      self.class.where(
        ["#{self.class.table_name}.parents_path <@ :old_path AND #{self.class.table_name}.id != :id", old_path: parents_path_before_last_save, id: id]
      ).update_all(
        ["parents_path = :new_path || subpath(parents_path, nlevel(:old_path))", new_path: parents_path, old_path: parents_path_before_last_save]
      )
    end
rubocop:enable Rails/SkipsModelValidations
 When an assembly changes their parent, we need to update the parents_path attribute on their descendants
 E.g. If we have the following tree:

 A (root assembly) parent = null, parents_path = A
 B (root assembly) parent = null, parents_path = B
 |- C (child assembly of B, descendant of B) parent = B, parents_path = B.C
    |- D (child assembly of C, descendant of B,C) parent = C, parents_path = B.C.D
    |- E (child assembly of C, descendant of B,C) parent = C, parents_path = B.C.E
       |- F (child assembly of E, descendant of B,C,E) parent = E, parents_path = B.C.E.F

 And we change the parent of C to A, this function updates the parents_path attribute in their
 descendants assemblies (D, E and F):

    |- D (child assembly of C, descendant of *A*,C) parent = C, parents_path = *A*.C.D
    |- E (child assembly of C, descendant of *A*,C) parent = C, parents_path = *A*.C.E
       |- F (child assembly of E, descendant of *A*,C,E) parent = E, parents_path = *A*.C.E.F

 Note: updating parents_path of C (the assembly in which we have changed the parent) is done in the `set_parents_path` function.

 rubocop:disable Rails/SkipsModelValidations