aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation/batches.rb
diff options
context:
space:
mode:
authorVijay Dev <vijaydev.cse@gmail.com>2012-05-30 22:40:49 +0530
committerVijay Dev <vijaydev.cse@gmail.com>2012-05-30 22:40:51 +0530
commit032f502f1221129d8446d3e25cd8956469b43456 (patch)
tree9b9deb7c24c8a1a4be9c09de73baa4b66271892a /activerecord/lib/active_record/relation/batches.rb
parent2adba2e2856584dbb9cbd1e6618b289acdded555 (diff)
downloadrails-032f502f1221129d8446d3e25cd8956469b43456.tar.gz
rails-032f502f1221129d8446d3e25cd8956469b43456.tar.bz2
rails-032f502f1221129d8446d3e25cd8956469b43456.zip
copy edit the batches docs [ci skip]
Diffstat (limited to 'activerecord/lib/active_record/relation/batches.rb')
-rw-r--r--activerecord/lib/active_record/relation/batches.rb16
1 files changed, 7 insertions, 9 deletions
diff --git a/activerecord/lib/active_record/relation/batches.rb b/activerecord/lib/active_record/relation/batches.rb
index 7330f1e215..fb4388d4b2 100644
--- a/activerecord/lib/active_record/relation/batches.rb
+++ b/activerecord/lib/active_record/relation/batches.rb
@@ -3,15 +3,13 @@ require 'active_support/core_ext/object/blank'
module ActiveRecord
module Batches
# Looping through a collection of records from the database
- # (using the +all+ method, for example) could be too straneous to your
- # memory if you have large amounts of them since it will try
- # to instantiate all the objects of it at once.
+ # (using the +all+ method, for example) is very inefficient
+ # since it will try to instantiate all the objects at once.
#
- # If that's the case, batch processing methods allow you to still work
- # with all the records found by the find +options+ but using groups of
- # a batch size (defaulting to 1000) at a time, greatly reducing the use of memory.
+ # In that case, batch processing methods allow you to work
+ # with the records in batches, thereby greatly reducing memory consumption.
#
- # The find_each method performs by using +find_in_batches+ with a batch size of 1000 (or as
+ # The <tt>find_each</tt> method uses <tt>find_in_batches</tt> with a batch size of 1000 (or as
# specified by the <tt>:batch_size</tt> option).
#
# Person.all.find_each do |person|
@@ -22,7 +20,7 @@ module ActiveRecord
# person.party_all_night!
# end
#
- # If needed, you can also send the <tt>:start</tt> option to specify
+ # You can also pass the <tt>:start</tt> option to specify
# an offset to control the starting point.
def find_each(options = {})
find_in_batches(options) do |records|
@@ -52,7 +50,7 @@ module ActiveRecord
# group.each { |person| person.party_all_night! }
# end
#
- # # Let's process the next 2000 party guys
+ # # Let's process the next 2000 records
# Person.all.find_in_batches(start: 2000, batch_size: 2000) do |group|
# group.each { |person| person.party_all_night! }
# end