title: Chaining ActiveRecord_Relation in PORO
body: <p>In a Rails 5.1 app, I have a query object (PORO) named <code>CoolProducts</code>.</p>
  
  <pre><code>class CoolProducts
    def self.call(relation = Product.all)
    ...
    # return an instance of Product::ActiveRecord_Relation
    end
  end
  </code></pre>
  
  <p>Now I need to limit the found <code>Product</code>s based on the fact the <code>name</code> matches a <code>string</code>.</p>
  
  <p>The following works</p>
  
  <pre><code>CoolProducts.call.where("name ILIKE ?", "%#{string}%")
  </code></pre>
  
  <p>However, I'd like to encapsulate the matching login within the <code>CoolProducts</code> class allowing to do something like</p>
  
  <pre><code>CoolProducts.call.including_in_name(string)
  </code></pre>
  
  <p>But I'm not sure where to start from.
  Any ideas?</p>