Tuesday, April 25

Ted's Has Many Helpers is on Ruby Forge

This is my first endeavor into a publicly available chunk of code (if you don't count my old JavaWorld articles -- eight years after the fact I still get e-mails about them), so it's probably a good thing that I'm starting with a script that's currently about a dozen lines long ;-) I haven't quite grokked all of the Ruby Forge goodness so bear with me as I try to figure out how to get it all set up and make the code easily available. If you have any experience publishing Rails plug-ins as gems or svn:externals (which is what I'm doing at the moment) please feel free to share your wealth of knowledge. Thanks, enjoy, and please be merciful.

http://rubyforge.org/projects/tedshasmanyhelp/

2 comments:

Anonymous said...

This is clever work, but I'm not sure it's a good idea to release it to the wild. If you keep an eye on the Rails commit log you'll see that there was just a change made yesterday to prevent using has_many collection methods on a through association. Your patch now probably breaks the tests in trunk. In the long run, I think you'll have a hard time keeping your patch running - through associations are still a bit of a moving target.

I still think using association extensions is the way to go. If I don't succumb to a post-conference cold today I'm going to try to write something up.

Teflon Ted said...

> This is clever work

Thanks :-)

> I'm not sure it's a good idea to release it to the wild.

I intend to keep a relatively low profile as I don't want it to distract me from my real pet project. Only my blog readers know of it, and I don't think there's too many of them, and an even smaller percentage of them have tried the code :-)

> If you keep an eye on the Rails commit log

I do not :-(

> you'll see that there was just a change made yesterday to prevent using has_many collection methods on a through association. Your patch now probably breaks the tests in trunk.

Ah, good to know. Note that my hack here doesn't apply to "through" associations per se; it works on relationships declared without the "through". I'll try to get a more up-to-date example project posted to illustrate that.

> I think you'll have a hard time keeping your patch running

I only intend to keep it running until they offer something better :-) I hope that's real soon now.

> If I don't succumb to a post-conference cold today I'm going to try to write something up.

As always, I look forward to reading it.

Thanks, Josh.