##// END OF EJS Templates
call Project#set_or_update_position_under in Project.rebuild_tree! (#12431)...
Toshi MARUYAMA -
r12408:962ecabc4767
parent child
Show More
@@ -421,6 +421,7 class Project < ActiveRecord::Base
421 421 transaction do
422 422 update_all "lft = NULL, rgt = NULL"
423 423 rebuild!(false)
424 all.each { |p| p.set_or_update_position_under(p.parent) }
424 425 end
425 426 end
426 427
@@ -1017,6 +1018,8 class Project < ActiveRecord::Base
1017 1018 set_or_update_position_under(parent)
1018 1019 end
1019 1020
1021 public
1022
1020 1023 # Inserts/moves the project so that target's children or root projects stay alphabetically sorted
1021 1024 def set_or_update_position_under(target_parent)
1022 1025 parent_was = parent
@@ -50,7 +50,7 class ProjectNestedSetTest < ActiveSupport::TestCase
50 50 def test_rebuild_should_build_valid_tree
51 51 Project.update_all "lft = NULL, rgt = NULL"
52 52
53 Project.rebuild!
53 Project.rebuild_tree!
54 54 assert_valid_nested_set
55 55 end
56 56
General Comments 0
You need to be logged in to leave comments. Login now