diff options
-rw-r--r-- | lib/arel/algebra/relations/operations/group.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/arel/algebra/relations/operations/group.rb b/lib/arel/algebra/relations/operations/group.rb index 2bfc42214b..68c626e917 100644 --- a/lib/arel/algebra/relations/operations/group.rb +++ b/lib/arel/algebra/relations/operations/group.rb @@ -1,12 +1,18 @@ module Arel class Group < Compound - attributes :relation, :groupings - deriving :== + attr_reader :groupings def initialize(relation, *groupings, &block) - @relation = relation + super(relation) @groupings = (groupings + arguments_from_block(relation, &block)) \ .collect { |g| g.bind(relation) } end + + def == other + super || + self.class === other && + @relation == other.relation && + @groupings == other.groupings + end end end |