mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Added collection iteration to AR::Relation.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -73,6 +73,5 @@ class RealtionTest < ActiveRecord::TestCase
|
||||
).to_a
|
||||
assert_equal 1, person_with_reader_and_post.size
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user