title: What is the proper way to eager load associated objects for a 'has_many' association?
body: <p>I am using Ruby on Rails 4 and I would like to eager load associated objects for a <code>has_many</code> association. That is, I have the following models:</p>
  
  <pre><code>class Article &lt; ActiveRecord::Base
    has_many :comments
  end
  
  class Comment &lt; ActiveRecord::Base
    belongs_to :article
  end
  </code></pre>
  
  <p>Since I frequently retrieve <code>comments</code> when I load <code>articles</code> I would like to eager load <code>comments</code> each time I search for <code>articles</code>, for example in these cases:</p>
  
  <pre><code># In these cases the eager loading should happen.
  Article.find(1)
  Article.where(:title =&gt; 'Sample text')
  @current_user.articles
  </code></pre>
  
  <p>What is the proper way to handle this issue? How?</p>