aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation/batches
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2016-02-21 03:28:18 +1030
committerMatthew Draper <matthew@trebex.net>2016-02-21 03:28:18 +1030
commitcdd45fa09d76f7c16ccbb6682e672a44f82174a0 (patch)
tree669f8316541c06bcf18692d7b4f6f9ba904ce119 /activerecord/lib/active_record/relation/batches
parent4f44348602446217df89536e911f516b065de33a (diff)
downloadrails-cdd45fa09d76f7c16ccbb6682e672a44f82174a0.tar.gz
rails-cdd45fa09d76f7c16ccbb6682e672a44f82174a0.tar.bz2
rails-cdd45fa09d76f7c16ccbb6682e672a44f82174a0.zip
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.
Diffstat (limited to 'activerecord/lib/active_record/relation/batches')
-rw-r--r--activerecord/lib/active_record/relation/batches/batch_enumerator.rb2
1 files changed, 1 insertions, 1 deletions
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