Permalink
Browse files

Added collection iteration to AR::Relation.

  • Loading branch information...
miloops committed Aug 3, 2009
1 parent 31c8353 commit f8eb4434d61fc1585c9b88dbb2d9159ea1f5b2fa
Showing with 4 additions and 1 deletion.
  1. +4 −0 activerecord/lib/active_record/relation.rb
  2. +0 −1 activerecord/test/cases/relations_test.rb
@@ -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

0 comments on commit f8eb443

Please sign in to comment.