Wednesday, January 31, 2007

The End is Nigh: Help Squash Rails Bugs

My friends, the end of the road is in sight for official Rails support.

Tom, Ola, and I have been working over the past week to get remaining Rails issues wrapped up. As a result of our efforts:

  • ActionPack is now "practically" 100% working, minus a test or two we can't support and a few tests that are broken or that run fine in isolation (it would be nice to know *why* those fail)
  • ActiveSupport is well above 95% passing
  • ActiveRecord is in the 90% range passing with MySQL and in the 80% range with Derby
The remaining modules are still yet to be worked, but they are mostly in high % as well: ActionWebService, ActionMailer, Railties

So here is a set of instructions on how YOU, dear reader, can help round out JRuby's support for Ruby on Rails.
  1. Getting a testbed set up
    1. Update JRuby trunk (, build it (ant clean jar), love it
    2. Install Rake (gem install rake)
    3. Fetch Rails 1.2.1 from Rails SVN at

  2. Running the tests
    1. From within the module under test (like activesupport/ or actionmailer/) just run "rake". All tests should execute and a report should be provided at the end. You can usually run tests individually as well, although a few depend on the side-effects of previous tests.
    2. ActiveRecord requires some additional setup; I'll update this post with Tom's instructions and patches shortly.

  3. Reporting issues
    1. Reporting failures in Rails is good
    2. Reporting reduced test cases or clear explanations for failures in Rails is better
    3. Reporting reduced test cases and including patches for failures in Rails is BEST
    4. Don't forget to check if your issue has already been reported, and please sync up on the mailing list while you're working
    5. Patches will probably not be accepted without a reusable test case. We're trying to grow our regression suite as a result of this work.
    6. JRuby's JIRA is here:

  4. Caveats, things to watch for, things to try
    1. ActiveRecord (with the AR-JDBC adapter) could use wider DB testing. We've done quite a bit of work with MySQL and Tom has been improving Derby support, but there are lots of other databases out there. Pick your favorite database, follow Tom's instructions to get up and going, and report issues (in the JRuby JIRA at least, but also report to jruby-extras project if appropriate)
    2. Railties includes code that will never run under JRuby, like its fcgi-based dispatcher tests. You should confirm with us that they're expected, and then ignore or delete them for your future runs.
    3. Rails is a very...interesting...application to debug. Feel free to ask on-list if you simply don't get something. I've seen things in Rails code no man should have to see, so I know it can be frustrating to debug at times.
We're on the home stretch now, and Rails is getting more and more solid every day. With you all helping, we should be able to finish off the remaining failures, clean up major outstanding JRuby issues, and kick out a pretty sweet "Rails-supporting" JRuby release in the next couple weeks.

Update: A couple folks pointed out that the codebase didn't compile under Java 1.4.2. That has been corrected!

Update 2: A few folks are seeing a problem installing gems related to the %p operator to printf. We're working on that, and it's a fairly minor issue, but to avoid it there's one additional step before you install rake: set the JRUBY_HOME env var to the root of your JRuby stuff.