rails/rails — pull request #14712 by al2o3cr (2014-04-11 19:39:30+00:00)
Title: Correctly handle joining scoped associations with table aliases.

Backport of #14154 to 4-0-stable.

/cc @abstractcoder - this fixes #12770 for 4.0.x
/cc @tenderlove