aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/algebra/relations/operations/having.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/arel/algebra/relations/operations/having.rb')
-rw-r--r--lib/arel/algebra/relations/operations/having.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/arel/algebra/relations/operations/having.rb b/lib/arel/algebra/relations/operations/having.rb
new file mode 100644
index 0000000000..cd16535609
--- /dev/null
+++ b/lib/arel/algebra/relations/operations/having.rb
@@ -0,0 +1,13 @@
+module Arel
+ class Having < Compound
+ attributes :relation, :havings
+ deriving :==
+
+ def initialize(relation, *havings, &block)
+ @relation = relation
+ @havings = (havings + arguments_from_block(relation, &block)) \
+ .collect { |g| g.bind(relation) }
+ end
+ end
+end
+