Nested has_many :through

Hi folks,

I'm using rails-1.2.2 and have run into unexpected behavior with
has_many :through.

I get a SQL exception reporting the use of an unknown column when I
use has_many :through to navigate thusly: Project -> BacklogItems ->
BacklogTask -> TimeEstimates.

It looks like rails omits a required join and somehow comes to believe
that it can navigate from a BacklogTask directly to a product.

The following code is available at for
those of you who prefer syntax-highlighting:

Interestingly, there's been a patch for this in Trac for months, but
it hasn't been imported because it doesn't come with unit tests.

Honestly, why the devs insist on tests in this particular case is
beyond me. Smells like dogma winning out over pragmatism.

Anyway, for the benefit of others who run into this, you can grab a
patch at:

Thanks, Josh.