Syntax cleaning.
Reworked for simpler and yet more reliable ActiveRecord 4.1 implementation.

However, this ignores the join_association_class setting - which means it will not work with Thinking Sphinx's adaption to handle polymorphic associations. Still mulling over how to deal with this.
Respect custom JoinAssociation class.

So, this is now both Rails 4.1 friendly and Thinking Sphinx + polymorphic association friendly. Albeit with the hackish approach of replacing constants - but I've not found any other way that doesn't involve copying a bunch of internal ActiveRecord code (which I really don't want to do - I'm tying myself to the implementation more closely than I'd like already).
Variable doesn't give us anything - and can become one line.
0.3.4