aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2012-11-08 10:49:33 -0800
committerSantiago Pastorino <santiago@wyeworks.com>2012-11-08 10:49:33 -0800
commit70f384e0196fd4f8bcb7dea05af8611df4578563 (patch)
treea133a1f54a0c5b01416afbb20d6adb50ba50beb7 /activerecord/lib/active_record
parentdbd0b12a077703e9dda1ea941c9aba4628a576e1 (diff)
parent16d98b2a41dec3619b9bd48b6b534406d9d07ef4 (diff)
downloadrails-70f384e0196fd4f8bcb7dea05af8611df4578563.tar.gz
rails-70f384e0196fd4f8bcb7dea05af8611df4578563.tar.bz2
rails-70f384e0196fd4f8bcb7dea05af8611df4578563.zip
Merge pull request #7987 from alexisbernard/3-2_find_in_batches_compatible_with_strings
Fix find_in_batches with customized primary_key on 3-2-stable
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/relation/batches.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation/batches.rb b/activerecord/lib/active_record/relation/batches.rb
index 2fd89882ff..14701f668c 100644
--- a/activerecord/lib/active_record/relation/batches.rb
+++ b/activerecord/lib/active_record/relation/batches.rb
@@ -59,11 +59,11 @@ module ActiveRecord
relation = apply_finder_options(finder_options)
end
- start = options.delete(:start).to_i
+ start = options.delete(:start)
batch_size = options.delete(:batch_size) || 1000
relation = relation.reorder(batch_order).limit(batch_size)
- records = relation.where(table[primary_key].gteq(start)).all
+ records = start ? relation.where(table[primary_key].gteq(start)).to_a : relation.to_a
while records.any?
records_size = records.size