Tuesday, May 13, 2008

My first JRuby contribution

I've reported lots of bugs before but this is the first time I submitted a fix back to an open source project.  The fix was to the JRuby-Extras ActiveRecord-JDBC project to allow you to do something like this for a Rails model class against Oracle:  

class Person
  set_table_name "department.people"
end

Accessing the database from someone other than the schema owner and therefore fully qualifying the table with schema is a rule I needed follow in order to deploy a webapp in my current IT department.  

I posted the original fix quite a while ago but nobody really took notice. Then Jesse Hu came along and made it better (and probably independently I might add) and also added a couple other fixes for things I hadn't noticed.  

But unfortunately neither one of us seemed to really know how to submit the fix so it got ignored for awhile.  Originally I created a patch and just pasted the text into the body of my comment.  Jesse attached the entire Java file.  A few days ago when Thomas Enebo asked for things we'd like to see fixed in the next release of JRuby I jumped at the chance.  After I got a hint about what to do from Charles Nutter, I got the latest version of the project from SVN, created a .patch file from Jesse's source, and then submitted it back to the JRuby-Extras Tracker and then finally back to JRuby's JIRA issue.

Today I got notice from Nick Sieger that it'll be in the next version.  Very cool.

Unfortunately I have to admit that I still a need a bit of work on my testing skills because I wasn't able to figure out where or how to insert some unit tests to prove that my fix worked.  Something to save for the next time. I'm just happy I can finally get rid of my custom version of this library.