aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2015-08-24 11:47:59 +0200
committerYves Senn <yves.senn@gmail.com>2015-08-24 11:47:59 +0200
commit5abff7cff7950e845b8bc3b88e7b8502748b623b (patch)
tree2ef240f2c71281b5d530b7619ce3ad2393e2e8d2 /guides
parentef8d09d932e36b0614905ea5bc3fb6af318b6ce2 (diff)
downloadrails-5abff7cff7950e845b8bc3b88e7b8502748b623b.tar.gz
rails-5abff7cff7950e845b8bc3b88e7b8502748b623b.tar.bz2
rails-5abff7cff7950e845b8bc3b88e7b8502748b623b.zip
guides, move incomplete example to corresponding option. #21349
[ci skip] This example is dependent on the `:end_at` option and has been removed from `4-2-stable` (d167b811520a6f800b86c77b805d15505a251bb8)
Diffstat (limited to 'guides')
-rw-r--r--guides/source/active_record_querying.md6
1 files changed, 4 insertions, 2 deletions
diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md
index 4b4d70d3ce..c0a4a0ba39 100644
--- a/guides/source/active_record_querying.md
+++ b/guides/source/active_record_querying.md
@@ -341,8 +341,6 @@ User.find_each(begin_at: 2000, batch_size: 5000) do |user|
end
```
-Another example would be if you wanted multiple workers handling the same processing queue. You could have each worker handle 10000 records by setting the appropriate `:begin_at` option on each worker.
-
**`:end_at`**
Similar to the `:begin_at` option, `:end_at` allows you to configure the last ID of the sequence whenever the highest ID is not the one you need.
@@ -356,6 +354,10 @@ User.find_each(begin_at: 2000, end_at: 10000, batch_size: 5000) do |user|
end
```
+Another example would be if you wanted multiple workers handling the same
+processing queue. You could have each worker handle 10000 records by setting the
+appropriate `:begin_at` and `:end_at` options on each worker.
+
#### `find_in_batches`
The `find_in_batches` method is similar to `find_each`, since both retrieve batches of records. The difference is that `find_in_batches` yields _batches_ to the block as an array of models, instead of individually. The following example will yield to the supplied block an array of up to 1000 invoices at a time, with the final block containing any remaining invoices: