rails/rails — pull request #14834 by al2o3cr (2014-04-21 23:23:24+00:00)
Title: Correctly alias table names when joining more than once

See #14155 for a longer description.

The attached commit has some notes; I'd appreciate some feedback, as the change to `AliasTracker` seems particularly hackish to me. All the tests pass, but the also all passed *before* I added the one in this commit :) so I'm uncertain if this is a well-covered area of functionality.

/cc @tenderlove