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.

mysql2 incompatibility in WikiPage model (Bug #390)

Added by Gregor Schmidt at 2011-05-10 10:15 pm. Updated at 2011-05-13 04:38 pm.

Status:Closed Start date:2011-05-10
Priority:Normal Due date:
Assignee:Eric Davis % Done:


Target version:2.0.0
Remote issue URL: Affected version:unstable


Introduced with fec6eb782c01aa018813, there is an incompatibility with the mysql2 database adapter. One main feature of mysql2, besides being actively maintained, is that it is eagerly casting database values to matching ruby types.

In this case in app/models/wiki_page.rb:134 CP tries to convert a value retrieved from the database into a date. This works fine for most adapters. But in mysql2 this value is already a Time. Ergo passing it to Time.parse results in an error. Consequently, the rescue block is triggered and nil is assigned.

This misbehavior results in failing tests in test/unit/wiki_page_test.rb and test/functional/wiki_controller_test.rb.

Associated revisions

Revision c2d058a5
Added by Gregor Schmidt at 2011-05-11 12:19 am

[#390] check to handle mysql2's early type casting


Updated by Gregor Schmidt at 2011-05-10 10:21 pm

  • Assignee deleted (Gregor Schmidt)
  • Status changed from Open to Ready for review

Updated by Eric Davis at 2011-05-13 03:23 pm

The patch looks fine but I can't reproduce the failure on mysql2 0.2.6 or 0.3.2. Can someone else reproduce it and confirm the fix?

Updated by Eric Davis at 2011-05-13 04:38 pm

Sorry, my database.yml was messed up and I was still loading postgres. Reproduced and confirmed the fix. Thank you for the patch/pull request.


  • Assignee set to Eric Davis
  • Category set to Wikis
  • Status changed from Ready for review to Closed

Also available in: Atom PDF