File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -53,18 +53,20 @@ def acts_as_tree(options = {})
53
53
# overwrite parent=
54
54
def parent_with_checking = ( new_parent )
55
55
if new_parent . present?
56
+ # chain to original relation
57
+ parent_without_checking = ( new_parent )
56
58
if new_parent != self . parent && new_parent . is_a? ( Mongoid ::Acts ::Tree )
57
59
self . write_attribute parent_id_field , new_parent . id
58
60
new_parent . children . push self , false
59
61
end
60
62
else
63
+ # chain to original relation
64
+ parent_without_checking = ( nil )
61
65
self . write_attribute parent_id_field , nil
62
66
self . path = [ ]
63
67
self . depth = 0
64
68
end
65
-
66
- # chain to original relation
67
- parent_without_checking = ( new_parent )
69
+
68
70
end
69
71
70
72
# use advise-around pattern to intercept mongoid relation
You can’t perform that action at this time.
0 commit comments