title: Retain only records whose belongs_to association's has_many has a COUNT of 2?
body: <p>This question is easy to understand with an example: like airbnb, guest reviews a host and host reviews a guest. The Booking has exactly 2 reviews (both created when the booking is created), and reviews have a field <code>submitted: true/false</code></p>
  <p>Suppose we wish to display a host's reviews on their profile, but suppose we want to <em>exclude</em> any reviews for which the host hasn't yet reviewed the guest. (so even if the guest has reviewed the host, it shouldn't be displayed until the host has reciprocated and reviewed the guest). How can we do it?</p>
  <p>Also a Booking has_many Reviews, and Reviews are polymorphic on Host and Guest.</p>
  <h3>What I know so far</h3>
  <p>I've come up with all sorts of half-solutions that either don't work, or result it awfully inefficient sql. Here's one</p>
  <pre class="lang-rb prettyprint-override"><code>bookings_for_host = Booking.where(host_id: 1).pluck(:id) # use host number 1 here for example
  all_reviews_for_relevant_bookings = Review.where('booking_id IN (?)', bookings_for_host)
  
  # This doesn't work
  all_reviews_for_relevant_bookings
    .select(&quot;booking_id&quot;)
    .group(&quot;booking_id&quot;)
    .having(&quot;COUNT(booking_id = 2&quot;)
  </code></pre>
  <p>The above code not only doesn't work, but it would also be inefficient.</p>
  <h3>Question</h3>
  <p>Ultimately, how could I filter a host's reviews so as to not include reviews that belong_to an Booking that has less than 2 reviews that have <code>submitted == true</code> ?</p>