title: Multiple nested includes in Rails
body: <p>Let's say I have four models, Groups, Users, Posts and Comments in my Rails 3 app. The relation is:</p>
  
  <pre><code>Groups has_many Users
  Users has_many Posts
  Posts has_many Comments
  </code></pre>
  
  <p>(and all with belongs_to in the other direction)</p>
  
  <p>How do I get all comments that belongs to a group.id in one query?
  I can not stop thinking of using multiple includes() (but without success so far) like</p>
  
  <pre><code>comments = Comment.includes(:Post).includes(:User).includes(:Group).where("groups.id IS ?", group.id)
  </code></pre>