Adds a Project.rebuild_tree! method to force the rebuild of the nested set.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10867 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2012-11-23 17:50:46 +00:00
parent 13f5301c09
commit 25c63ec747
2 changed files with 18 additions and 0 deletions
+9
View File
@@ -393,6 +393,15 @@ class Project < ActiveRecord::Base
end
end
# Recalculates all lft and rgt values based on project names
# Unlike Project.rebuild!, these values are recalculated even if the tree "looks" valid
def self.rebuild_tree!
transaction do
update_all "lft = NULL, rgt = NULL"
rebuild!(false)
end
end
# Returns an array of the trackers used by the project and its active sub projects
def rolled_up_trackers
@rolled_up_trackers ||=