Allowing has_many to ignore foreign key

I'm working on a plug-in that will allow has_many associations to
ignore the foreign key. This may sound silly, but there are situations
where you'd like to join on something other than a single foreign key.
Right now, I can configure :conditions for the association, but these
are in addition to the existing foreign key.

My plug-in would do something akin to http://pastie.org/319143. This
is really just pseudo-code, I haven't tested it yet.

So, two questions:

- Am I the only one crazy enough to think something like this is
useful?
- How can a plugin monkey-patch ActiveRecord for this? Just override
the entire construct_sql method?

Thanks for any advice,

Norman

Perhaps not a rails-core topic.... but... I've done this before in a
plugin I've done called grouped_scope. Links below. In fact I did
exactly what you mentioned, just method chained construct_sql. Check
if out if you want.

http://github.com/metaskills/grouped_scope/tree/master
http://www.metaskills.net/2008/9/28/jack-has_many-things

  - Ken