title: Conditional includes in Single Table Inheritance models
body: <p>I have my models like this:</p>
  
  <pre><code>A &lt; ActiveRecord::Base
  - has_many :z
  
  B &lt; A
  - has_many :y
  
  C &lt; A
  - has_many :x
  </code></pre>
  
  <p>Somewhere, I want to do something like:</p>
  
  <pre><code>A.all.includes([:z,:y, :x])
  </code></pre>
  
  <p>But it doesn't work, because some items are from specific type <code>B</code> and other are <code>C</code>.</p>
  
  <p>How can I conditionally include one or another?</p>