title: Adding a "where" clause to Rails "include" in ActiveRecord
body: <ul>
  <li>Users have many Sites</li>
  <li>Sites have many Controllers</li>
  <li>Controllers have many Inspections</li>
  </ul>
  
  <p>This is what I have at the moment.</p>
  
  <pre><code>current_user
     .sites
     .joins(:controllers)
     .where('controllers.inspections_enabled = true')
     .all(:include =&gt; [:controllers =&gt; [:inspections]])
  </code></pre>
  
  <p>This gives me:</p>
  
  <p>"All sites where a controller is enabled, with all controllers and inspections"</p>
  
  <p>I want</p>
  
  <p>"All sites where a controller is enabled, and include ONLY controllers which has 'inspections_enabled = true', with all it's child inspections"</p>
  
  <p>Thanks in Advance</p>