Project

General

Profile

Actions

Defect #4780

closed

ActionView::TemplateError (undefined method `<=>' for nil:NilClass)

Added by Anonymous about 14 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
2010-02-09
Due date:
% Done:

100%

Estimated time:
Resolution:
Fixed
Affected version:

Description

Hi,

I am kind of lost with this problem.

I updated to latest version v0.9.2 with two servers. On the first one everything is fine and running. The second machine is presenting me this error with the exact same code base.

Processing WelcomeController#index (for 192.168.22.16 at 2010-02-09 10:06:41) [GET]
  Parameters: {"action"=>"index", "controller"=>"welcome"}
Rendering template within layouts/base
Rendering welcome/index

ActionView::TemplateError (undefined method `<=>' for nil:NilClass) on line #38 of app/views/layouts/base.rhtml:
35:         <%= link_to l(:label_search), {:controller => 'search', :action => 'index', :id => @project}, :accesskey => accesskey(:search) %>:
36:         <%= text_field_tag 'q', @question, :size => 20, :class => 'small', :accesskey => accesskey(:quick_search) %>
37:         <% end %>
38:         <%= render_project_jump_box %>
39:     </div>
40:
41:     <h1><%= page_header_title %></h1>

    app/helpers/application_helper.rb:218:in `sort_by'
    app/helpers/application_helper.rb:218:in `project_tree'
    app/helpers/application_helper.rb:206:in `project_tree_options_for_select'
    app/helpers/application_helper.rb:196:in `render_project_jump_box'
    app/views/layouts/base.rhtml:38:in `_run_rhtml_app47views47layouts47base46rhtml'

Rendering /opt/redmine/redmine-0.9.2/public/500.html (500 Internal Server Error)

Information about my setup:

root@ruby:/opt/redmine/redmine-0.9.2# RAILS_ENV="production" script/about
About your application's environment
Ruby version              1.8.6 (i486-linux)
RubyGems version          1.3.5
Rack version              1.0
Rails version             2.3.5
Active Record version     2.3.5
Active Resource version   2.3.5
Action Mailer version     2.3.5
Active Support version    2.3.5
Edge Rails revision       unknown
Application root          /opt/redmine/redmine-0.9.2
Environment               production
Database adapter          mysql
Database schema version   20091227112908

About your Redmine plugins
Global filter plugin   0.0.1

Any ideas?

Actions #1

Updated by Jean-Philippe Lang about 14 years ago

There's something wrong with your project tree. Can you try:

ruby script/runner -e production 'Project.rebuild!'

Can you also give the output of the following query so I can try to reproduce:

SELECT id, parent_id, lft, rgt FROM projects
Actions #2

Updated by Anonymous about 14 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Problem is resolved.

ruby script/runner -e production 'Project.rebuild!'
did the trick!
Actions #3

Updated by Felix Schäfer about 14 years ago

  • Status changed from Resolved to Closed
  • Resolution set to Fixed
Actions #4

Updated by Kaoru Kobo over 13 years ago

I met same problem.

How about changing the instruction in RedmineUpgrade: http://www.redmine.org/wiki/redmine/RedmineUpgrade

to following?

rake db:migrate RAILS_ENV=production 
ruby script/runner -e production 'Project.rebuild!'
Actions #5

Updated by Adrien Crivelli over 13 years ago

I also had same symptoms. However the issue in my case was corrupted data. One project (which was manually migrated from another redmine instance using the script mentionned there: http://www.redmine.org/boards/1/topics/20067?r=20204#message-20204) had a parent_id value set to 0.

Once identified it was quickly fixed with: UPDATE projects SET parent_id = NULL WHERE parent_id = 0;

Actions

Also available in: Atom PDF