From cdd45fa09d76f7c16ccbb6682e672a44f82174a0 Mon Sep 17 00:00:00 2001 From: Matthew Draper Date: Sun, 21 Feb 2016 03:28:18 +1030 Subject: Mutating the result of Relation#to_a should not affect the relation Clarifying this separation and enforcing relation immutability is the culmination of the previous efforts to remove the mutator method delegations. --- activerecord/lib/active_record/relation/batches/batch_enumerator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/relation/batches') diff --git a/activerecord/lib/active_record/relation/batches/batch_enumerator.rb b/activerecord/lib/active_record/relation/batches/batch_enumerator.rb index c6e39814dd..13393dc605 100644 --- a/activerecord/lib/active_record/relation/batches/batch_enumerator.rb +++ b/activerecord/lib/active_record/relation/batches/batch_enumerator.rb @@ -35,7 +35,7 @@ module ActiveRecord return to_enum(:each_record) unless block_given? @relation.to_enum(:in_batches, of: @of, start: @start, finish: @finish, load: true).each do |relation| - relation.to_a.each { |record| yield record } + relation.records.each { |record| yield record } end end -- cgit v1.2.3