diff options
Diffstat (limited to 'lib/arel/algebra/relations')
-rw-r--r-- | lib/arel/algebra/relations/operations/project.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/arel/algebra/relations/operations/project.rb b/lib/arel/algebra/relations/operations/project.rb index 49d0e1be36..2cdae288e3 100644 --- a/lib/arel/algebra/relations/operations/project.rb +++ b/lib/arel/algebra/relations/operations/project.rb @@ -1,10 +1,9 @@ module Arel class Project < Compound - attributes :relation, :projections - deriving :== + attr_reader :projections def initialize(relation, *projections, &block) - @relation = relation + super(relation) @projections = (projections + arguments_from_block(relation, &block)) \ .collect { |p| p.bind(relation) } end @@ -16,5 +15,12 @@ module Arel def externalizable? attributes.any? { |a| a.respond_to?(:aggregation?) && a.aggregation? } || relation.externalizable? end + + def == other + super || + Project === other && + relation == other.relation && + projections == other.projections + end end end |