diff options
Diffstat (limited to 'lib/arel/nodes/grouping.rb')
-rw-r--r-- | lib/arel/nodes/grouping.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/arel/nodes/grouping.rb b/lib/arel/nodes/grouping.rb new file mode 100644 index 0000000000..0af1df1f7a --- /dev/null +++ b/lib/arel/nodes/grouping.rb @@ -0,0 +1,21 @@ +module Arel + module Nodes + class Grouping < Arel::Nodes::Node + attr_accessor :expr + + def initialize expression + @expr = expression + end + + # FIXME: this method should go away. I don't like people calling + # to_sql on non-head nodes. This forces us to walk the AST until we + # can find a node that has a "relation" member. + # + # Maybe we should just use `Table.engine`? :'( + def to_sql + viz = Visitors::ToSql.new Table.engine + viz.accept self + end + end + end +end |