aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/nodes/grouping.rb
blob: 0af1df1f7a6f5bd8ae3efea177151b4c82c2915b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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