From f8eb4434d61fc1585c9b88dbb2d9159ea1f5b2fa Mon Sep 17 00:00:00 2001 From: Emilio Tagua Date: Mon, 3 Aug 2009 14:15:47 -0300 Subject: Added collection iteration to AR::Relation. --- activerecord/lib/active_record/relation.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activerecord/lib') 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 -- cgit v1.2.3