aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/relations/grouping.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/arel/relations/grouping.rb')
-rw-r--r--lib/arel/relations/grouping.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/arel/relations/grouping.rb b/lib/arel/relations/grouping.rb
new file mode 100644
index 0000000000..ccca600360
--- /dev/null
+++ b/lib/arel/relations/grouping.rb
@@ -0,0 +1,19 @@
+module Arel
+ class Grouping < Compound
+ attr_reader :expressions, :groupings
+
+ def initialize(relation, *groupings)
+ @relation, @groupings = relation, groupings.collect { |g| g.bind(relation) }
+ end
+
+ def ==(other)
+ self.class == other.class and
+ relation == other.relation and
+ groupings == other.groupings
+ end
+
+ def aggregation?
+ true
+ end
+ end
+end \ No newline at end of file