diff options
author | Alexis Bernard <alexis@obloh.com> | 2012-10-30 15:54:16 +0100 |
---|---|---|
committer | Alexis Bernard <alexis@obloh.com> | 2012-11-08 17:52:54 +0100 |
commit | 16d98b2a41dec3619b9bd48b6b534406d9d07ef4 (patch) | |
tree | 9adbd54d6c0492703cb438a93326971e6382bc6d /activerecord/lib/active_record/relation/batches.rb | |
parent | 7031e365d6a8c00b62354f4abe8dff4802b38adf (diff) | |
download | rails-16d98b2a41dec3619b9bd48b6b534406d9d07ef4.tar.gz rails-16d98b2a41dec3619b9bd48b6b534406d9d07ef4.tar.bz2 rails-16d98b2a41dec3619b9bd48b6b534406d9d07ef4.zip |
Fix find_in_batches against string IDs when start option is not specified.
Conflicts:
activerecord/CHANGELOG.md
activerecord/lib/active_record/relation/batches.rb
Diffstat (limited to 'activerecord/lib/active_record/relation/batches.rb')
-rw-r--r-- | activerecord/lib/active_record/relation/batches.rb | 4 |
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 e7d916f2da..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) || 0 + 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 |