title: :include and table aliasing
body: <p>I'm suffering from a variant of <a href="https://rails.lighthouseapp.com/projects/8994/tickets/2357-predictable-table-aliases-in-joins" rel="noreferrer">the problem described here</a>:</p>
  
  <blockquote>
    <p>ActiveRecord assigns table aliases for
    association joins fairly
    unpredictably.  The first association
    to a given table keeps the table
    name. Further joins with associations
    to that table use aliases including
    the association names in the path... 
    but it is common for app developers
    not to know about [other] joins at
    coding time.</p>
  </blockquote>
  
  <p>In my case I'm being bitten by a toxic mix of has_many and :include.  Many tables in my schema have a <code>state</code> column, and the has_many wants to specify conditions on that column: <code>has_many :foo, :conditions =&gt; {:state =&gt; 1}</code>.  However, since the state column appears in many tables, I disambiguate by explicitly specifying the table name: <code>has_many :foo, :conditions =&gt; "this_table.state = 1"</code>.  </p>
  
  <p>This has worked fine until now, when for efficiency I want to add an <code>:include</code> to preload a fairly deep tree of data.  This causes the table to be aliased inconsistently in different code paths.  My reading of the tickets referenced above is that this problem is not and will not be fixed in Rails 2.x.  However, I don't see any way to apply the suggested workaround (to specify the aliased table name explicitly in the query).  I'm happy to specify the table alias explicitly in the has_many statement, but I don't see any way to do so.  As such, the workaround doesn't appear applicable to this situation (nor, I presume, in many 'named_scope' scenarios).</p>
  
  <p>Is there a viable workaround?  </p>