File tree 1 file changed +2
-2
lines changed
1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ def _ct_skip_sort_order_maintenance!
20
20
end
21
21
22
22
def _ct_validate
23
- if !@_ct_skip_cycle_detection &&
23
+ if !( defined? @_ct_skip_cycle_detection ) &&
24
24
!new_record? && # don't validate for cycles if we're a new record
25
25
changes [ _ct . parent_column_name ] && # don't validate for cycles if we didn't change our parent
26
26
parent . present? && # don't validate if we're root
@@ -64,7 +64,7 @@ def _ct_before_destroy
64
64
65
65
def rebuild! ( called_by_rebuild = false )
66
66
_ct . with_advisory_lock do
67
- delete_hierarchy_references unless @was_new_record
67
+ delete_hierarchy_references unless ( defined? @was_new_record ) && @was_new_record
68
68
hierarchy_class . create! ( :ancestor => self , :descendant => self , :generations => 0 )
69
69
unless root?
70
70
_ct . connection . execute <<-SQL . strip_heredoc
You can’t perform that action at this time.
0 commit comments