diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-28 14:50:32 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-28 14:55:00 -0700 |
commit | 1dbbc1b9871bd65d6ba149152b5deb23a53b67f8 (patch) | |
tree | c15f1fbfde40af5e7bd0ae9c9b6b1c687c29c7b6 /lib/arel/algebra | |
parent | f97b8d5b9df6b1f496fce1170e4331746b37662f (diff) | |
download | rails-1dbbc1b9871bd65d6ba149152b5deb23a53b67f8.tar.gz rails-1dbbc1b9871bd65d6ba149152b5deb23a53b67f8.tar.bz2 rails-1dbbc1b9871bd65d6ba149152b5deb23a53b67f8.zip |
Enumerable implements #first
Diffstat (limited to 'lib/arel/algebra')
-rw-r--r-- | lib/arel/algebra/relations/relation.rb | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/lib/arel/algebra/relations/relation.rb b/lib/arel/algebra/relations/relation.rb index 62d9bf177c..ccc1ab558f 100644 --- a/lib/arel/algebra/relations/relation.rb +++ b/lib/arel/algebra/relations/relation.rb @@ -1,5 +1,7 @@ module Arel module Relation + include Enumerable + @@connection_tables_primary_keys = {} attr_reader :count @@ -93,18 +95,9 @@ module Arel orders.collect { |o| o.to_sql(Sql::OrderClause.new(self)) } end - module Enumerable - include ::Enumerable - - def each - session.read(self).each { |e| yield e } - end - - def first - session.read(self).first - end + def each + session.read(self).each { |e| yield e } end - include Enumerable module Operable def join(other_relation = nil, join_class = InnerJoin) |