diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2014-01-27 06:47:46 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2014-01-27 06:47:46 +0000 |
commit | ba75aa504b498ff7d77a23d5d57bf3e43e4b13b7 (patch) | |
tree | c7e6d6c6b19cb531fe6a260d9e94e7b53e5c06e4 /config/initializers | |
parent | 4f996fa5c20ceee635ff553a9bedd67080bcc9dd (diff) | |
download | redmine-ba75aa504b498ff7d77a23d5d57bf3e43e4b13b7.tar.gz redmine-ba75aa504b498ff7d77a23d5d57bf3e43e4b13b7.zip |
move r12689 awesome_nested_set modification to config/initializers/10-patches.rb (#7920)
git-svn-id: http://svn.redmine.org/redmine/trunk@12733 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'config/initializers')
-rw-r--r-- | config/initializers/10-patches.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/config/initializers/10-patches.rb b/config/initializers/10-patches.rb index 0ddbcdd06..881206c9e 100644 --- a/config/initializers/10-patches.rb +++ b/config/initializers/10-patches.rb @@ -203,6 +203,8 @@ module ActionController end end +require 'awesome_nested_set/version' + module CollectiveIdea module Acts module NestedSet @@ -211,6 +213,23 @@ module CollectiveIdea new_record? || leaf_without_new_record? end alias_method_chain :leaf?, :new_record + # Reload is needed because children may have updated + # their parent (self) during deletion. + if ::AwesomeNestedSet::VERSION > "2.1.6" + module Prunable + def destroy_descendants_with_reload + destroy_descendants_without_reload + reload + end + alias_method_chain :destroy_descendants, :reload + end + else + def destroy_descendants_with_reload + destroy_descendants_without_reload + reload + end + alias_method_chain :destroy_descendants, :reload + end end end end |