rails/rails — pull request #9969 by divineforest (2013-03-28 12:24:46+00:00)
Title: Fail early with "Primary key not included in the custom select clause" i...

...n find_in_batches

Before this patch find_in_batches raises this error only on second iteration. So you will know about the problem only when you get the batch size threshold.