diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-10-31 07:49:42 -0700 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-10-31 07:49:42 -0700 |
commit | 92bae4929dbc3ca65b44d8338b44789b5e320313 (patch) | |
tree | 25e5f33cc12853e6bb522538951319470b484c01 /activerecord/lib | |
parent | 6a6909dc2940ac0a6d3536fdac96bdce55a18023 (diff) | |
parent | a58cafeb3a86be46849de57481b6644094fb8165 (diff) | |
download | rails-92bae4929dbc3ca65b44d8338b44789b5e320313.tar.gz rails-92bae4929dbc3ca65b44d8338b44789b5e320313.tar.bz2 rails-92bae4929dbc3ca65b44d8338b44789b5e320313.zip |
Merge pull request #8073 from alexisbernard/fix_find_in_batches_start_option
Fix find_in_batches against string IDs when start option is not specified
Diffstat (limited to 'activerecord/lib')
-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 8af0c6a8ef..b921f2eddb 100644 --- a/activerecord/lib/active_record/relation/batches.rb +++ b/activerecord/lib/active_record/relation/batches.rb @@ -62,11 +62,11 @@ module ActiveRecord ActiveRecord::Base.logger.warn("Scoped order and limit are ignored, it's forced to be batch order and batch size") 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)).to_a + records = start ? relation.where(table[primary_key].gteq(start)).to_a : relation.to_a while records.any? records_size = records.size |