diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-12-28 12:58:30 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-12-28 12:58:30 -0300 |
commit | bd00a461e042a77aef48822040897467c544cd1a (patch) | |
tree | 8272c2d78da319bde1ab6d736ce6f66b352a25e6 /lib/arel/algebra/relations/operations | |
parent | 4fe6bdf195336d54b082ca26b96c5294d8aae3d1 (diff) | |
download | rails-bd00a461e042a77aef48822040897467c544cd1a.tar.gz rails-bd00a461e042a77aef48822040897467c544cd1a.tar.bz2 rails-bd00a461e042a77aef48822040897467c544cd1a.zip |
Added having to use in combination with group to filter records.
Diffstat (limited to 'lib/arel/algebra/relations/operations')
-rw-r--r-- | lib/arel/algebra/relations/operations/having.rb | 13 |
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 + |