title: Set ActiveRecord Scopes In A Loop
body: <p>Why doesn't this work?</p>
  
  <pre><code>class Foo
    ...
    Status.each do |status|
      scope status, where(status: status)
    end
    ...
  end
  </code></pre>
  
  <p>Now <code>Foo.new</code> it returns not an instance of Foo but an ActiveRecord::Relation.</p>