title: Converting an array of objects to ActiveRecord::Relation
body: <p>I have an array of objects, let's call it an <code>Indicator</code>. I want to run Indicator class methods (those of the <code>def self.subjects</code> variety, scopes, etc) on this array. The only way I know to run class methods on a group of objects is to have them be an ActiveRecord::Relation. So I end up resorting to adding a <code>to_indicators</code> method to <code>Array</code>.</p>
  
  <pre><code>def to_indicators
    # TODO: Make this less terrible.
    Indicator.where id: self.pluck(:id)
  end
  </code></pre>
  
  <p>At times I chain quite a few of these scopes to filter down the results, within the class methods. So, even though I call a method on an ActiveRecord::Relation, I don't know how to access that object. I can only get to the contents of it through <code>all</code>. But <code>all</code> is an Array. So then I have to convert that array to a ActiveRecord::Relation. For example, this is part of one of the methods:</p>
  
  <pre><code>all.to_indicators.applicable_for_bank(id).each do |indicator|
    total += indicator.residual_risk_for(id)
    indicator_count += 1 if indicator.completed_by?(id)
  end
  </code></pre>
  
  <p>I guess this condenses down to two questions.</p>
  
  <ol>
  <li>How can I convert an Array of objects to an ActiveRecord::Relation? Preferably without doing a <code>where</code> each time.</li>
  <li>When running a <code>def self.subjects</code> type method on an ActiveRecord::Relation, how do I access that ActiveRecord::Relation object itself?</li>
  </ol>
  
  <p>Thanks. If I need to clarify anything, let me know.</p>