summaryrefslogtreecommitdiffstats
path: root/vendor
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-01-22 11:46:15 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-01-22 11:46:15 +0000
commit419b195019a276513d1d58a0ed7d7a18c58425be (patch)
tree2caea3a0a8bf97fc06be9441befa30cf78d5ff9b /vendor
parentccdea234ad655fab8125e34c0bbad7d27accc886 (diff)
downloadredmine-419b195019a276513d1d58a0ed7d7a18c58425be.tar.gz
redmine-419b195019a276513d1d58a0ed7d7a18c58425be.zip
Fixed: subtasks are deleted (not destroyed) when destroying parent issue (#7385).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4735 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'vendor')
-rw-r--r--vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb6
1 files changed, 4 insertions, 2 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 0229a8e5c..fc5278d69 100644
--- a/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb
+++ b/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb
@@ -444,17 +444,19 @@ 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?
- diff = right - left + 1
+ return if right.nil? || left.nil? || !self.class.exists?(id)
delete_method = acts_as_nested_set_options[:dependent] == :destroy ?
:destroy_all : :delete_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]
)
+ reload_nested_set
+ diff = right - left + 1
nested_set_scope.update_all(
["#{quoted_left_column_name} = (#{quoted_left_column_name} - ?)", diff],
["#{quoted_left_column_name} >= ?", right]