File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 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!
2020 end
2121
2222 def _ct_validate
23- if !@_ct_skip_cycle_detection &&
23+ if !( defined? @_ct_skip_cycle_detection ) &&
2424 !new_record? && # don't validate for cycles if we're a new record
2525 changes [ _ct . parent_column_name ] && # don't validate for cycles if we didn't change our parent
2626 parent . present? && # don't validate if we're root
@@ -64,7 +64,7 @@ def _ct_before_destroy
6464
6565 def rebuild! ( called_by_rebuild = false )
6666 _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
6868 hierarchy_class . create! ( :ancestor => self , :descendant => self , :generations => 0 )
6969 unless root?
7070 _ct . connection . execute <<-SQL . strip_heredoc
You can’t perform that action at this time.
0 commit comments