Project

General

Profile

Actions

Defect #12460

closed

Project.rebuild_tree! fails

Added by Ken Zalewski over 11 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Projects
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

In version 2.1.4, sorting projects by name was fixed. I confirmed this by running:

ruby script/rails runner 'Project.update_all(:lft=>nil,:rgt=>nil); Project.rebuild!'

Out of the box, projects were sorted properly without me having to patch the awesome_nested_set code.

However, a new method was added called 'Project.rebuild_tree!' to make it easier to rebuild the project list. This method is supposed to clear the lefts and rights, then rebuild.

This new method is failing.

Running:

ruby script/rails runner 'Project.rebuild_tree!'

produces the following errors:

/usr/lib64/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `block in require': iconv will be deprecated in the future, use String#encode instead.
/usr/lib64/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/commands/runner.rb:53:in `eval': undefined method `rebuild_tree!' for #<Class:0x000000024842f0> (NoMethodError)
from (eval):1:in `<top (required)>'
from /usr/lib64/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/commands/runner.rb:53:in `eval'
from /usr/lib64/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/commands/runner.rb:53:in `<top (required)>'
from /usr/lib64/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/commands.rb:64:in `require'
from /usr/lib64/ruby/gems/1.9.1/gems/railties-3.2.8/lib/rails/commands.rb:64:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

Actions #1

Updated by Jean-Philippe Lang over 11 years ago

  • Status changed from New to Closed
  • Resolution set to Invalid

The fix was merged in 2.1-stable but the new method Project.rebuild_tree! is only available in trunk for the forthcoming 2.2.0 release. Sorry, I did not mention that in #6836-43110.

Actions #2

Updated by Asif Noor over 8 years ago

It worked fine for me. It has recalculated all lft and rgt values.

Go to your project doc root and execute this

ruby script/rails runner 'Project.rebuild_tree!'

My Redmine version 2.4.2 Stable

Actions

Also available in: Atom PDF