Added collection iteration to AR::Relation.

This commit is contained in:
Emilio Tagua
2009-08-03 14:15:47 -03:00
parent 31c83534d6
commit f8eb4434d6
2 changed files with 4 additions and 1 deletions

View File

@@ -13,6 +13,10 @@ module ActiveRecord
@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

View File

@@ -73,6 +73,5 @@ class RealtionTest < ActiveRecord::TestCase
).to_a
assert_equal 1, person_with_reader_and_post.size
end
end