Created
March 13, 2014 08:48
-
-
Save simsicon/9524574 to your computer and use it in GitHub Desktop.
Mongoid doesn't support find_in_batches, this is a work around for it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
per_batch = 10 | |
0.step(User.count, per_batch) do |offset| | |
puts User.limit(per_batch).skip(offset).map(&:username).inspect | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment