ChiliProject is not maintained anymore. Please be advised that there will be no more updates.

We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.

ActionView::TemplateError (undefined method `new0' for DateTime:Class) (Bug #903)

Added by George Plymale at 2012-02-25 04:02 pm. Updated at 2012-03-18 05:17 pm.

Status:Closed Start date:2012-02-25
Priority:Normal Due date:
Assignee:Holger Just % Done:


Target version:3.1.0
Remote issue URL: Affected version:3.0.0


As per our discussion here:

It appears that there is an issue with ruby 1.9.3 and the ChiliProject 3.0 release.

In my case I just upgraded to ChiliProject 3.0, created a new user and their login fails (old users login fine). The error is:

ActionView::TemplateError (undefined method `new0' for DateTime:Class) on line #6 of app/views/news/_news.rhtml:
3: <%= "(#{l(:label_x_comments, :count => news.comments_count)})" if news.comments_count > 0 >
4: &lt;br /&gt;
5: < unless news.summary.blank? >&lt;span class="summary"&gt;<=h news.summary >&lt;/span&gt;&lt;br /&gt;< end >
6: &lt;span class="author"&gt;<= authoring news.created_on, %>&lt;/span&gt;&lt;/p&gt
(eval):2:in `to_date'
lib/redmine/i18n.rb:54:in `format_date'
lib/redmine/i18n.rb:62:in `format_time'
app/helpers/application_helper.rb:329:in `time_tag'
app/helpers/application_helper.rb:321:in `authoring'
app/views/news/_news.rhtml:6:in `_run_rhtml_app47views47news47_news46rhtml_locals_news_news_counter_object'
app/views/welcome/index.rhtml:8:in `_run_rhtml_app47views47welcome47index46rhtml'
&lt;internal:prelude&gt;:10:in `synchronize'
thin (1.2.11) lib/thin/connection.rb:84:in `block in pre_process'
thin (1.2.11) lib/thin/connection.rb:82:in `catch'
thin (1.2.11) lib/thin/connection.rb:82:in `pre_process'
thin (1.2.11) lib/thin/connection.rb:57:in `process'
thin (1.2.11) lib/thin/connection.rb:42:in `receive_data'
eventmachine (0.12.10) lib/eventmachine.rb:256:in `run_machine'
eventmachine (0.12.10) lib/eventmachine.rb:256:in `run'
thin (1.2.11) lib/thin/backends/base.rb:61:in `start'
thin (1.2.11) lib/thin/server.rb:159:in `start'
thin (1.2.11) lib/thin/controllers/controller.rb:86:in `start'
thin (1.2.11) lib/thin/runner.rb:185:in `run_command'
thin (1.2.11) lib/thin/runner.rb:151:in `run!'
thin (1.2.11) bin/thin:6:in `&lt;top (required)&gt;'
/usr/local/rvm/gems/ruby-1.9.3-p125@all/bin/thin:19:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p125@all/bin/thin:19:in `&lt;main&gt;'

Associated revisions

Revision 6348eeaf
Added by Jean-Philippe Lang at 2008-04-02 11:30 pm

Attachment model clean up: fixed some inconsistent indentation and an inaccurate comment (closes patch #903 by Rocco Stanzione).

git-svn-id: e93f8b46-1217-0410-a6f0-8f06a7374b81

Revision 68efc3de
Added by Holger Just at 2012-03-18 06:15 pm

[#903] Require updated tzinfo with fix for Ruby 1.9.3


Updated by Michaël Rigart at 2012-02-25 07:27 pm

Hi George

I read the topic on the forum, but could you elaborate a bit more how you trigger this error. I'm using ruby 1.9.3 by default and I can seem to get this error.

I made a test project, added some news to it, and then created a new user. When I login as the new user, I can perfectly view the news items on the test project.

Updated by George Plymale at 2012-02-25 08:11 pm

Are you using 1.9.3-p0 or 1.9.3-p125? I've not tried p0 yet with it so that might be the differential.

At any rate, I'm using rvm on FreeBSD 8.2. Simply performed an `rvm install 1.9.3-p125`, `rvm --default ruby-1.9.3-p125@all` and then did a `bundle install` for the following Gemfile:

You'll notice I added the two lines aside from the Gemfile being default:
gem "rack", "~>1.1.2"
gem "thin", "~> 1.2.11"

I'm using the following to start things up (customized rc file that overrides with the 1.9.3-p125 paths):

Updated by Michaël Rigart at 2012-02-27 10:10 am

Strange, I can't seem to reproduce this. I've tested it on 1.9.3-p0 and 1.9.3-p125 (which I'm also running in production) .

Could you like check in the database if you can find a record in the news table where the created_on value is empty, or find a date time value that looks off?

Updated by George Plymale at 2012-02-29 11:26 pm

I actually cleared out the news table when this happened (deleted news) and so there are no news items in the table at all.

Updated by Holger Just at 2012-03-12 09:58 pm

I can't fully reproduce it either, but I guess I know where the culprit lies.

r31668 of Ruby (which is included in Ruby 1.9.3 but not 1.9.2) change the API of DateTime again. This API is used by tzinfo (which in turn is bundled by ActiveSupport). Rails 2.3.14 bundles tzinfo 0.3.12 which uses! if it is defined, else DateTime.new0. The latter was user by older Ruby versions and is deprecated since 1.8.6 and was removed in 1.9.0. The former was present between Ruby 1.8.6 and 1.9.2.

The mentioned commit now removes! which in turn requires a change of tzinfo. That change is included in tzinfo 0.3.28 which explicitly restores 1.9.3 compatibility. See for the changelog. Current ActiveSupport requires tzinfo 0.3.31.

So to mitigate this bug, could you try to add this to your Gemfile.local, run bundle install and try again if you still get the bug?

gem "tzinfo", "~> 0.3.31" 
  • Status changed from Open to Needs more information

Updated by Mak Babu at 2012-03-16 04:55 am

Could reproduce the issue and the resolution mentioned above fixes the issue to perfection.

Updated by Felix Schäfer at 2012-03-16 06:38 am

Mmh, should we try to add a switch to the Gemfile to require this version for 1.9.3 or would mentioning it in the docs be enough?

Updated by Holger Just at 2012-03-16 07:31 am

I would include it unconditionally. It doesn't seem to hurt anyone and at the very least provides some updated timezone info.

  • Status changed from Needs more information to Ready for review

Updated by Felix Schäfer at 2012-03-16 07:35 am

Holger Just wrote:

I would include it unconditionally. It doesn't seem to hurt anyone and at the very least provides some updated timezone info.

Works for me too, be sure to comment it accordingly :-)

Updated by Holger Just at 2012-03-18 05:17 pm

Committed in 68efc3d

  • Assignee set to Holger Just
  • Category set to Libraries
  • Status changed from Ready for review to Closed

Also available in: Atom PDF