title: Rails ActiveRecord WHERE EXISTS query
body: <p>I have an SQL query that returns what I need, but I'm having trouble converting this into an active record query the "Rails way".</p>
  
  <p>My SQL query is:</p>
  
  <pre><code>SELECT * from trips 
  WHERE trips.title LIKE "%Thailand%"
  AND EXISTS (SELECT * from places WHERE places.trip_id = trips.id AND places.name LIKE "%Bangkok%")
  AND EXISTS (SELECT * from places WHERE places.trip_id = trips.id AND places.name LIKE "%Phuket%")
  </code></pre>
  
  <p>I'm trying something like this using Rails:</p>
  
  <pre><code>@trips=Trip.where("trips.title LIKE ?", "%Thailand%")
  @trips=@trips.includes(:places).where(("places.name LIKE ?","%Bangkok%").exists?) =&gt; true, ("places.name LIKE ?","%Phuket%").exists?) =&gt; true)
  </code></pre>
  
  <p>But it doesn't seem to work and i'm stumped as to what to try.</p>