Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #2004 from knapo/3-0-stable

Backport of #1997
  • Loading branch information...
commit e9f2c67874a8b9a2f1fd4df068f8640bb266f139 2 parents 9e4d156 + e2d90bf
@spastorino spastorino authored
View
2  activerecord/lib/active_record/relation/batches.rb
@@ -20,8 +20,6 @@ def find_each(options = {})
find_in_batches(options) do |records|
records.each { |record| yield record }
end
-
- self
end
# Yields each batch of records that was found by the find +options+ as
View
7 activerecord/test/cases/batches_test.rb
@@ -17,6 +17,13 @@ def test_each_should_excecute_one_query_per_batch
end
end
+ def test_each_should_not_return_query_chain_and_execcute_only_one_query
+ assert_queries(1) do
+ result = Post.find_each(:batch_size => 100000){ }
+ assert_nil result
+ end
+ end
+
def test_each_should_raise_if_select_is_set_without_id
assert_raise(RuntimeError) do
Post.find_each(:select => :title, :batch_size => 1) { |post| post }
Please sign in to comment.
Something went wrong with that request. Please try again.