My first Ruby on Rails patch was just committed to the trunk. I'm now officially a Rails contributor. Yay me!
Changeset 4206 is my patch for enhancing the :extend
option to allow multiple named extension modules on associations.
I've wanted this ever since I started using extension modules. I quickly ran into a situation where I wanted to use two named modules for the same association. Here's the hacked way of doing that:
has_many :friends, do
include PeopleExtension
include FriendsExtension
end
The change in my patch allows this more compact syntax:
has_many :friends, :extend => [PeopleExtension, FriendsExtension]
So much better!
This patch was a bit of a trial run for me to learn the whole process for putting a patch together. The actual change was only one line of Ruby code (but don't forget the 20 or so lines of tests and documentation!). Now that I seem to have the process down I can think about doing something a bit bigger.
As I get more confident in the process I'll write up a better description of how to contribute changes to Rails. The description on the Rails Trac is pretty bare-bones and takes a bit of muddling through if you've never worked on an open source project before.
Congratulations! We can use more contributions like these, makes the code look elegant :)
Congrats! Excellent work!!
excellent -- cool that you're a contributor and big ups for you blog, I have used it as a reference tool a number of times.
If you ever get around to writing that how to submit a patch to rails article, you'll have one very eager reader right here! (Small overview of the framework, preparing and running tests (how railties fits in), etc.)