aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-12-26 16:56:24 -0700
committerSean Griffin <sean@thoughtbot.com>2014-12-26 16:56:24 -0700
commitb4e6e47471ef951fe134a74cf71544c10a8638f5 (patch)
treebbccec9308e4aa617ab79e231a5a42a0d8882ffc /activerecord/lib
parenta11a8ff7840cd5c5ebb881aac61be9771b07b3ba (diff)
downloadrails-b4e6e47471ef951fe134a74cf71544c10a8638f5.tar.gz
rails-b4e6e47471ef951fe134a74cf71544c10a8638f5.tar.bz2
rails-b4e6e47471ef951fe134a74cf71544c10a8638f5.zip
We don't need to type cast the offset in `find_in_batches`
Part of the larger refactoring to remove type casting from Arel. We can inform it that we already have the right type by wrapping the value in an `Arel::Nodes::Quoted`. This commit can be reverted when we have removed type casting from Arel in Rail 5.1
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/relation/batches.rb6
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