diff options
-rw-r--r-- | lib/arel/algebra/relations/relation.rb | 15 | ||||
-rw-r--r-- | spec/algebra/unit/relations/relation_spec.rb | 2 |
2 files changed, 5 insertions, 12 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) diff --git a/spec/algebra/unit/relations/relation_spec.rb b/spec/algebra/unit/relations/relation_spec.rb index 40b8c6585a..f51ecd7789 100644 --- a/spec/algebra/unit/relations/relation_spec.rb +++ b/spec/algebra/unit/relations/relation_spec.rb @@ -189,7 +189,7 @@ module Arel end end - describe Relation::Enumerable do + describe 'is enumerable' do it "implements enumerable" do @relation.map { |value| value }.should == @relation.session.read(@relation).map { |value| value } |