title: return custom query as an activerecord relation
body: <p>I wrote this custom query, which I don't think can be converted nicely using active record query interface:</p>
  
  <pre><code>SELECT * FROM dockets 
  INNER JOIN entries 
  ON entries.docket_id = dockets.id 
  WHERE NOT EXISTS 
  ( 
    SELECT 1 FROM entries AS e 
    WHERE e.docket_id = dockets.id 
    AND e.docket_type REGEXP 'Key1|Key2|Key3|Key4' 
  )
  </code></pre>
  
  <p>I can execute this query using <code>connection.execute</code>:</p>
  
  <pre><code>sql = "SELECT * FROM dockets INNER JOIN entries ON entries.docket_id = dockets.id WHERE NOT EXISTS ( SELECT 1 FROM entries AS e WHERE e.docket_id = dockets.id AND e.docket_type REGEXP 'Key1|Key2|Key3|Key4' )"
  Docket.connection.execute(sql)
  </code></pre>
  
  <p>The problem is does not return an ActiveRecord::Relation. It gives me a MySQL::Result object. Therefore I cannot append relation methods to it:</p>
  
  <pre><code>Docket.connection.execute(sql).limit(10)
  NoMethodError: undefined method `limit' for #&lt;Mysql2::Result:0x007fcd1dde6330&gt; 
  </code></pre>
  
  <p>Is there another interface I can use to return an ActiveRecord::Relation object so I can continue to append relation methods to it? And if not, what other options do I have?</p>