diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2014-01-21 06:51:06 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2014-01-21 06:51:06 +0000 |
commit | 65d2df44db2b7f42178850cc36bd5465f90a7832 (patch) | |
tree | 2fc84104c966cc6f0c8361070cc99b07af7d7351 /lib/plugins | |
parent | 962ecabc4767e1c0c3d3ceb1ef18de1edc9d34ba (diff) | |
download | redmine-65d2df44db2b7f42178850cc36bd5465f90a7832.tar.gz redmine-65d2df44db2b7f42178850cc36bd5465f90a7832.zip |
back out r12679 awesome_nested_set 2.1.5 modification
git-svn-id: http://svn.redmine.org/redmine/trunk@12684 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/plugins')
-rw-r--r-- | lib/plugins/awesome_nested_set/lib/awesome_nested_set/awesome_nested_set.rb | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/plugins/awesome_nested_set/lib/awesome_nested_set/awesome_nested_set.rb b/lib/plugins/awesome_nested_set/lib/awesome_nested_set/awesome_nested_set.rb index 9832a655b..b101a5ef2 100644 --- a/lib/plugins/awesome_nested_set/lib/awesome_nested_set/awesome_nested_set.rb +++ b/lib/plugins/awesome_nested_set/lib/awesome_nested_set/awesome_nested_set.rb @@ -198,17 +198,14 @@ module CollectiveIdea #:nodoc: # set left node[left_column_name] = indices[scope.call(node)] += 1 # find - where(["#{quoted_parent_column_name} = ? #{scope.call(node)}", node]). - order(acts_as_nested_set_options[:order]). - each{|n| set_left_and_rights.call(n) } + where(["#{quoted_parent_column_full_name} = ? #{scope.call(node)}", node]).order("#{quoted_left_column_full_name}, #{quoted_right_column_full_name}, id").each{|n| set_left_and_rights.call(n) } # set right node[right_column_name] = indices[scope.call(node)] += 1 node.save!(:validate => validate_nodes) end # Find root node(s) - root_nodes = where("#{quoted_parent_column_name} IS NULL"). - order(acts_as_nested_set_options[:order]).each do |root_node| + root_nodes = where("#{quoted_parent_column_full_name} IS NULL").order("#{quoted_left_column_full_name}, #{quoted_right_column_full_name}, id").each do |root_node| # setup index for this scope indices[scope.call(root_node)] ||= 0 set_left_and_rights.call(root_node) @@ -593,7 +590,6 @@ module CollectiveIdea #:nodoc: ["#{quoted_right_column_name} = (#{quoted_right_column_name} - ?)", diff] ) - reload # Don't allow multiple calls to destroy to corrupt the set self.skip_before_destroy = true end |