Active record querying for children objects of multiple parent objects
<p>Let's say i have two models:</p>

<pre><code>class Post &lt; ActiveRecord::Base
  has_many :comments
end

class Comment &lt; ActiveRecord::Base
  belongs_to :post
end
</code></pre>

<p>Then assume I've created 2 posts with 3 comments each. Is there a query I can call on an AR relation of those two posts to grab all the comments that belong to those two posts? </p>

<p>I could do:</p>

<pre><code>@posts = Post.where(id: [1,2])
@comments = []
@posts.each do |post|
  @comments += post.comments
end
</code></pre>

<p>But then it's not an AR relation, plus seems like this should be a simple query.</p>

<p>Is there anything like <code>@posts.comments</code>?</p>