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
This commit is contained in:
Toshi MARUYAMA 2014-01-27 06:47:46 +00:00
parent 4f996fa5c2
commit ba75aa504b
2 changed files with 19 additions and 2 deletions

View File

@ -203,6 +203,8 @@ module ActionController
end end
end end
require 'awesome_nested_set/version'
module CollectiveIdea module CollectiveIdea
module Acts module Acts
module NestedSet module NestedSet
@ -211,6 +213,23 @@ module CollectiveIdea
new_record? || leaf_without_new_record? new_record? || leaf_without_new_record?
end end
alias_method_chain :leaf?, :new_record 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 end
end end

View File

@ -593,8 +593,6 @@ module CollectiveIdea #:nodoc:
["#{quoted_right_column_name} = (#{quoted_right_column_name} - ?)", diff] ["#{quoted_right_column_name} = (#{quoted_right_column_name} - ?)", diff]
) )
# Reload is needed because children may have updated their parent (self) during deletion.
reload
# Don't allow multiple calls to destroy to corrupt the set # Don't allow multiple calls to destroy to corrupt the set
self.skip_before_destroy = true self.skip_before_destroy = true
end end