From 108df8cc90fc32ca08ff1cc86bc79ceb03ee1bfc Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Fri, 26 Dec 2014 17:48:08 -0700 Subject: Inform Arel we don't need additional type casting 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 --- activerecord/lib/active_record/relation/batches.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/relation/batches.rb b/activerecord/lib/active_record/relation/batches.rb index 9f20db831b..f7b2167ae8 100644 --- a/activerecord/lib/active_record/relation/batches.rb +++ b/activerecord/lib/active_record/relation/batches.rb @@ -52,7 +52,12 @@ module ActiveRecord end else enum_for :find_each, options do - options[:start] ? where(table[primary_key].gteq(options[:start])).size : size + # FIXME: Remove this when type casting is removed from Arel + # (Rails 5.1). We can pass start directly instead. + if options[:start] + quoted_start = Arel::Nodes::Quoted.new(options[:start]) + end + options[:start] ? where(table[primary_key].gteq(quoted_start)).size : size end end end -- cgit v1.2.3