rails/rails — pull request #10303 by ahorner (2013-04-22 18:00:42+00:00)
Title: Preserve context for joins while merging relations

This is a backport of #10164, already merged into
master. The issue is described in lengthy detail
in issues #3002 and #5494.