diff options
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/inheritance.rb | 1 | ||||
-rw-r--r-- | activerecord/lib/active_record/relation/batches.rb | 23 | ||||
-rw-r--r-- | activerecord/lib/active_record/validations/uniqueness.rb | 1 |
3 files changed, 4 insertions, 21 deletions
diff --git a/activerecord/lib/active_record/inheritance.rb b/activerecord/lib/active_record/inheritance.rb index 8a532402ba..b91e9ac137 100644 --- a/activerecord/lib/active_record/inheritance.rb +++ b/activerecord/lib/active_record/inheritance.rb @@ -193,7 +193,6 @@ module ActiveRecord def type_condition(table = arel_table) sti_column = table[inheritance_column] sti_names = ([self] + descendants).map(&:sti_name) - sti_names.map! { |v| Arel::Nodes::Quoted.new(v) } # FIXME: Remove this when type casting in Arel is removed (5.1) sti_column.in(sti_names) end diff --git a/activerecord/lib/active_record/relation/batches.rb b/activerecord/lib/active_record/relation/batches.rb index f7b2167ae8..4f0502ae75 100644 --- a/activerecord/lib/active_record/relation/batches.rb +++ b/activerecord/lib/active_record/relation/batches.rb @@ -52,12 +52,7 @@ module ActiveRecord end else enum_for :find_each, options do - # 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 + options[:start] ? where(table[primary_key].gteq(options[:start])).size : size end end end @@ -107,15 +102,9 @@ module ActiveRecord start = options[:start] batch_size = options[:batch_size] || 1000 - if start - # FIXME: Remove this when type casting is removed from Arel - # (Rails 5.1). We can pass start directly instead. - quoted_start = Arel::Nodes::Quoted.new(start) - end - unless block_given? return to_enum(:find_in_batches, options) do - total = start ? where(table[primary_key].gteq(quoted_start)).size : size + total = start ? where(table[primary_key].gteq(start)).size : size (total - 1).div(batch_size) + 1 end end @@ -125,7 +114,7 @@ module ActiveRecord end relation = relation.reorder(batch_order).limit(batch_size) - records = start ? relation.where(table[primary_key].gteq(quoted_start)).to_a : relation.to_a + records = start ? relation.where(table[primary_key].gteq(start)).to_a : relation.to_a while records.any? records_size = records.size @@ -136,11 +125,7 @@ module ActiveRecord break if records_size < batch_size - # 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 + records = relation.where(table[primary_key].gt(primary_key_offset)).to_a end end diff --git a/activerecord/lib/active_record/validations/uniqueness.rb b/activerecord/lib/active_record/validations/uniqueness.rb index c4ff2e3ef3..9ff2ad9c6b 100644 --- a/activerecord/lib/active_record/validations/uniqueness.rb +++ b/activerecord/lib/active_record/validations/uniqueness.rb @@ -64,7 +64,6 @@ module ActiveRecord value = value.to_s[0, column.limit] end - # FIXME: Remove this when type casting is removed from Arel (Rails 5.1) value = Arel::Nodes::Quoted.new(value) comparison = if !options[:case_sensitive] && value && column.text? |