diff options
-rw-r--r-- | activerecord/lib/active_record/relation/batches.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/batches.rb b/activerecord/lib/active_record/relation/batches.rb index 4f0502ae75..ac13b37dce 100644 --- a/activerecord/lib/active_record/relation/batches.rb +++ b/activerecord/lib/active_record/relation/batches.rb @@ -125,7 +125,11 @@ module ActiveRecord break if records_size < batch_size - records = relation.where(table[primary_key].gt(primary_key_offset)).to_a + # FIXME: Remove this when type casting is removed from Arel + # (Rails 5.1). We can pass the offset directly instead. + quoted_offset = Arel::Nodes::Quoted.new(primary_key_offset) + + records = relation.where(table[primary_key].gt(quoted_offset)).to_a end end |