提交 f8eb4434 编写于 作者: E Emilio Tagua

Added collection iteration to AR::Relation.

上级 31c83534
......@@ -13,6 +13,10 @@ def to_a
@klass.find_by_sql(@relation.to_sql)
end
def each(&block)
to_a.each(&block)
end
def first
@relation = @relation.take(1)
to_a.first
......
......@@ -73,6 +73,5 @@ def test_joins_with_string_array
).to_a
assert_equal 1, person_with_reader_and_post.size
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册