title: How to sort authors by their book count with ActiveRecord?
body: <p>Let's say I have Book model and an Author model. I want to list all authors sorted by their book count. What's the best way to do that?</p>
  
  <p>I know how to do this in SQL, either by doing where .. in with a nested select or with some join. But what I'd like to know is how to do this nicely with ActiveRecord.</p>