title: How to perform eager loading on model descendants using Rails and Ancestry
body: <p>As for now I'm working on a blog application that has article/comment models connected via has_many/belongs_to associations. To create nested comments functionality I use ancestry gem. However, I would like to eager load all of the descendants of a comment. Is there any ideas of how to approach this? 
  I tried using <em>join</em> and <em>where</em> but it seems like they produce n + 1 queries.
  Here is how I call the method to display them in the view.</p>
  
  <pre><code>&lt;%= nested_comments_display comments.arrange(:order =&gt; :created_at) %&gt;
  </code></pre>
  
  <p>And here is <em>nested_comments_display</em> method</p>
  
  <pre><code>def nested_comments_display(comments)
    comments.map do |comment, sub_comments|
      render(comment) + content_tag(:div,nested_comments_display(sub_comments), 
                                  :class =&gt; "nested_comment")
    end.join.html_safe
  end
  </code></pre>
  
  <p>I also use decent_exposure gem and my CommentsController looks like this</p>
  
  <pre><code>class CommentsController &lt; ApplicationController
  
    expose(:article)
    expose(:comments, ancestor: :article) 
    expose(:comment, attributes: :comment_params)
  
    ....
  end
  </code></pre>