diff options
Diffstat (limited to 'config/initializers/ar5_batching.rb')
-rw-r--r-- | config/initializers/ar5_batching.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/config/initializers/ar5_batching.rb b/config/initializers/ar5_batching.rb index 31efef83a6f..35e8b3808e2 100644 --- a/config/initializers/ar5_batching.rb +++ b/config/initializers/ar5_batching.rb @@ -15,7 +15,7 @@ module ActiveRecord relation = relation.where(arel_table[primary_key].lteq(finish)) if finish batch_relation = relation - 1.step do |index| + loop do if load records = batch_relation.records ids = records.map(&:id) @@ -31,7 +31,7 @@ module ActiveRecord primary_key_offset = ids.last raise ArgumentError.new("Primary key not included in the custom select clause") unless primary_key_offset - yield yielded_relation, index + yield yielded_relation break if ids.length < of batch_relation = relation.where(arel_table[primary_key].gt(primary_key_offset)) |