mirror of
https://github.com/redmine/redmine.git
synced 2025-11-18 03:00:52 +01:00
Fixed: Error deleting issue with grandchild (#8880).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6311 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -446,16 +446,16 @@ module CollectiveIdea #:nodoc:
|
||||
def prune_from_tree
|
||||
return if right.nil? || left.nil? || leaf? || !self.class.exists?(id)
|
||||
|
||||
delete_method = acts_as_nested_set_options[:dependent] == :destroy ?
|
||||
:destroy_all : :delete_all
|
||||
|
||||
# TODO: should destroy children (not descendants) when deleted_method is :destroy_all
|
||||
self.class.base_class.transaction do
|
||||
reload_nested_set
|
||||
nested_set_scope.send(delete_method,
|
||||
["#{quoted_left_column_name} > ? AND #{quoted_right_column_name} < ?",
|
||||
left, right]
|
||||
)
|
||||
if acts_as_nested_set_options[:dependent] == :destroy
|
||||
children.each(&:destroy)
|
||||
else
|
||||
nested_set_scope.send(:delete_all,
|
||||
["#{quoted_left_column_name} > ? AND #{quoted_right_column_name} < ?",
|
||||
left, right]
|
||||
)
|
||||
end
|
||||
reload_nested_set
|
||||
diff = right - left + 1
|
||||
nested_set_scope.update_all(
|
||||
|
||||
Reference in New Issue
Block a user