More grouping/batching logic options than what's included in Rails