summaryrefslogtreecommitdiffstats
path: root/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-04-01 18:58:29 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-04-01 18:58:29 +0000
commit2c4cc25433d818066c154a0220eb0b435f59bed3 (patch)
tree9ef17f961441d442b31975bf07153050521e859c /vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb
parent6550ef9df55f8f6cc1422e33c310d2e274fd456a (diff)
downloadredmine-2c4cc25433d818066c154a0220eb0b435f59bed3.tar.gz
redmine-2c4cc25433d818066c154a0220eb0b435f59bed3.zip
Limits nested set overhead when destroying an issue without children.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5286 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb')
-rw-r--r--vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb b/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb
index b2ebd669c..b1e5ae1e7 100644
--- a/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb
+++ b/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb
@@ -444,11 +444,12 @@ module CollectiveIdea #:nodoc:
# Prunes a branch off of the tree, shifting all of the elements on the right
# back to the left so the counts still work.
def prune_from_tree
- return if right.nil? || left.nil? || !self.class.exists?(id)
+ 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,