Fixing monkey patching of rubytree to be more robust
This commit is contained in:
parent
0caf4b3d5e
commit
61e20cb29d
|
@ -23,12 +23,13 @@ module TreeNodePatch
|
||||||
base.class_eval do
|
base.class_eval do
|
||||||
attr_reader :last_items_count
|
attr_reader :last_items_count
|
||||||
|
|
||||||
alias :old_initilize :initialize
|
def initialize_with_redmine(name, content = nil)
|
||||||
def initialize(name, content = nil)
|
extend InstanceMethods
|
||||||
old_initilize(name, content)
|
|
||||||
@last_items_count = 0
|
@last_items_count = 0
|
||||||
extend(InstanceMethods)
|
|
||||||
|
initialize_without_redmine(name, content)
|
||||||
end
|
end
|
||||||
|
alias_method_chain :initialize, :redmine
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -99,7 +100,9 @@ module TreeNodePatch
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Tree::TreeNode.send(:include, TreeNodePatch)
|
unless Tree::TreeNode.included_modules.include?(TreeNodePatch)
|
||||||
|
Tree::TreeNode.send(:include, TreeNodePatch)
|
||||||
|
end
|
||||||
|
|
||||||
module Redmine
|
module Redmine
|
||||||
module MenuManager
|
module MenuManager
|
||||||
|
|
Loading…
Reference in New Issue