提交 63861e0c 编写于 作者: S Santiago Pastorino

Merge pull request #1997 from knapo/master

Make `ActiveRecord::Batches#find_each` to not return `self`.
......@@ -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
......
......@@ -18,6 +18,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 }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册