This is an issue also described in rails ticket #6924 
Simple :conditions on associations work very well when associations
are loaded separately, but they don't work so well when eager
loading is used and either several tables use the same field name
or the more extreme case of the same table appearing more than
once in the SQL (self-referential associations).
The first case can be worked around by just refering to the table
attributes in :conditions through their table name, and ActiveRecord
even does it automatically when the conditions are specified
as a hash.
In the second case the workarounds are more limited, it is possible
to find out how activerecord aliases a table in a specific case so
in the :conditions you can use that alias but this association would
only work in that one specific case, it can not be eager loaded in
any way that would produce a different alias and whats worse it
can not be loaded in the normal way (without eager loading).
It's clear that not all association options can be supported for
eager loading so one could argue that :conditions being limited
in this way is fine but I think this could be fixed.
What is needed is a way to refer to the table of the current
association in :conditions in a way that allows ActiveRecord to
replace those references with the real table name or alias. In case
of conditions as a hash this would require no syntax changes at
all but in other cases it would require a special marker, like the
one used for named or positional bind
variables (":table", ":current_table", ":association"...).
Do you think this should be fixed?
Have I described a solution that would be acceptable?
Thanks in advance for any responses,