diff options
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/relation.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 1c3a1dc53b..f89baa1a74 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -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 |