rails/rails — pull request #16353 by eileencodes (2014-07-31 00:35:43+00:00)
Title: Refactor join_keys to remove complex conditionals

This PR refactors join_keys to remove complex conditionals.

Each part of the conditional is now moved into the Reflection associated with it. This is made possible by reducing the need for `source_macro` (and eventually the deprecation of `source_macro`) through adding `join_id_for` to each reflection that needs it as well.

Because the conditional in `join_association` is the same we can replace that with the `join_keys` method from Reflection. :smile_cat:

This reduces the complexity of `join_keys` quite a bit. This is towards a larger refactoring of `add_constraints` and `join_constraints`.