Skip to content

Commit 938e9d6

Browse files
author
amitsaxena
committedFeb 3, 2017
reload child node only if it has persisted. Issue #249
1 parent 5a62b87 commit 938e9d6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed
 

‎lib/closure_tree/numeric_deterministic_ordering.rb

+6-3
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,12 @@ def prepend_child(child_node)
8989
child_node.order_value = -1
9090
child_node.parent = self
9191
child_node._ct_skip_sort_order_maintenance!
92-
child_node.save
93-
_ct_reorder_children
94-
child_node.reload
92+
if child_node.save
93+
_ct_reorder_children
94+
child_node.reload
95+
else
96+
child_node
97+
end
9598
end
9699

97100
def append_sibling(sibling_node)

0 commit comments

Comments
 (0)