diff options
-rw-r--r-- | lib/arel/algebra/relations/operations/project.rb | 8 | ||||
-rw-r--r-- | spec/algebra/unit/relations/relation_spec.rb | 6 |
2 files changed, 5 insertions, 9 deletions
diff --git a/lib/arel/algebra/relations/operations/project.rb b/lib/arel/algebra/relations/operations/project.rb index 8136f7ce9b..b78d5d3e97 100644 --- a/lib/arel/algebra/relations/operations/project.rb +++ b/lib/arel/algebra/relations/operations/project.rb @@ -5,6 +5,7 @@ module Arel def initialize(relation, *projections) super(relation) @projections = projections.collect { |p| p.bind(relation) } + @attributes = nil end def attributes @@ -15,13 +16,6 @@ module Arel attributes.any? { |a| a.respond_to?(:aggregation?) && a.aggregation? } || relation.externalizable? end - def == other - super || - Project === other && - relation == other.relation && - projections == other.projections - end - def eval unoperated_rows.collect { |r| r.slice(*projections) } end diff --git a/spec/algebra/unit/relations/relation_spec.rb b/spec/algebra/unit/relations/relation_spec.rb index f51ecd7789..8d0639ee07 100644 --- a/spec/algebra/unit/relations/relation_spec.rb +++ b/spec/algebra/unit/relations/relation_spec.rb @@ -72,8 +72,10 @@ module Arel describe '#project' do it "manufactures a projection relation" do - @relation.project(@attribute1, @attribute2). \ - should == Project.new(@relation, @attribute1, @attribute2) + project = @relation.project(@attribute1, @attribute2) + project.relation.should == @relation + project.projections.should == [@attribute1, @attribute2] + project.should be_kind_of Project end describe "when given blank attributes" do |