#find_in_batches should support returning Active Relations as well as arrays

I was directed here from the rails repo.

Currently find_in_batches converts all relations into arrays before yielding to the block.

It would be nice if we could just work with relations (which are lazy if I can recall correctly) and allow the consumer to manipulate data as deemed fit. This will also allow some operations to be performed in batches (i.e. staggeringupdate_all) instead of needing to recreate the set.

Looking at the code it shouldn’t be hard to implement, and I don’t mind working on the patch. I just wanted to get feedback on this before I go ahead and write up the code.

Seems good, but could be a bit odd to work with. Most people will have written code that expects an Array. It seems like an AR relation behaves exactly like an array (not sure if there are known caveats here). If there aren’t any major caveats, and there’s no speed degradation and all tests pass, I say go for it.