I think it would be better if this took any array-like resource instead of just ActiveRecord relations. Not a biggie if that is hard to implement, though, I think.