Project

General

Profile

Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab

Added by Leo L. over 11 years ago

Hello,

I am running Redmine 2.0.3 stable :
Environment:
Redmine version 2.0.3.stable
Ruby version 1.8.7 (amd64-freebsd9)
Rails version 3.2.6
Environment production
Database adapter MySQL
Redmine plugins:
no plugin installed

I'm testing redmine out, so I've created a test project with a dummy task in it, and see how redmine is displaying it.
But when I'm trying to access Gantt tab, I'm encountering a "500 - Internal error" :

Started GET "/projects/newconsole/issues/gantt" for 10.0.2.142 at Fri Aug 24 12:37:45 +0000 2012
Processing by GanttsController#show as HTML
Parameters: {"project_id"=>"newconsole"}
Completed 500 Internal Server Error in 13ms

NoMethodError (undefined method `-' for true:TrueClass):
lib/redmine/helpers/gantt.rb:69:in `initialize'
app/controllers/gantts_controller.rb:34:in `new'
app/controllers/gantts_controller.rb:34:in `show'

The same exact error for Calendar tab.
Other tabs and functionnalities are working fine...

Is someone has an idea on how to fix this ?

Thanks,

--
Léo L.


Replies (33)

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Etienne Massip over 11 years ago

Sorry, either set your RAILS_ENV environment variable to production or run ruby script/rails c --sandbox.

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Leo L. over 11 years ago

Etienne,

OK, that's it :

[leo@srv-freebsd /usr/local/www/redmine]# ruby script/rails c --sandbox
Loading production environment in sandbox (Rails 3.2.6)
Any modifications you make will be rolled back on exit
irb(main):001:0> Date.today >> 6
NoMethodError: undefined method `-' for true:TrueClass
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.2.6/lib/active_support/core_ext/date/calculations.rb:24:in `>>'
from (irb):1
irb(main):002:0> quit
(0.2ms) ROLLBACK

Wow, seems to be a new indication about date calculations.
But my skills are again too limited to figure it out alone...

--
Léo L.

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Etienne Massip over 11 years ago

Still in Rails console:

RUBY_VERSION

then

RUBY_VERSION.class

then

RUBY_VERSION < '1.9'

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Etienne Massip over 11 years ago

In fact, no need.

This is clearly because RUBY_VERSION is < '1.9' (makes sense since you're running 1.8.7) but ruby stdlib Date#valid_civil? is 1.9, returning a boolean instead of the date or Nil.

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Leo L. over 11 years ago

Haha, I'm feeling like a blind pilot here :)
There is the requested output.

[root@srv-freebsd /usr/local/www/redmine]# ruby script/rails c --sandbox
Loading production environment in sandbox (Rails 3.2.6)
Any modifications you make will be rolled back on exit
irb(main):001:0> RUBY_VERSION
=> "1.8.7"
irb(main):002:0> RUBY_VERSION.class
=> String
irb(main):003:0> RUBY_VERSION < '1.9'
=> true
irb(main):004:0> quit
(0.1ms) ROLLBACK

--
Léo.

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Etienne Massip over 11 years ago

Your Ruby 1.8.7 setup is broken maybe because you installed a 1.9 over a 1.8 or something similar (I don't know Freebsd installation mechanisms at all).

Could you run irb -rdate and then Date.valid_civil? 2012, 8, 30, 1 ?

This should return a date but you'll get a =>true instead, which is wrong.

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Leo L. over 11 years ago

Etienne,

Thanks for pointing out what's wrong about my config.
You're test was quite demonstrative. You were guessing right :

[root@srv-freebsd /usr/local/www/redmine]# irb -rdate
irb(main):001:0> Date.valid_civil? 2012, 8, 30, 1
=> true

When I first installed redmine, I tried to use ruby1.9 because it was the latest version.
But on redmine's website I saw that ruby1.8 was the standard and I downgraded it.
I'll manage to unbroke ruby now.

Merci beaucoup Etienne :)

--
Léo.

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Leo L. over 11 years ago

Etienne,

I owe you and the community a feedback.
I uninstall everything's related to ruby on my system, then installed ruby19 only.
Last time I tried that, I didn't remove ruby18 when installing ruby19, maybe that wasn't correct.

It works like a charm now.
Thank you very much ! :)

--
Léo L.

(26-33/33)