class Arel::Visitors::ToSql

def visit_Arel_Nodes_NamedFunction o

def visit_Arel_Nodes_NamedFunction o
  "#{o.name}(#{o.distinct ? 'DISTINCT ' : ''}#{o.expressions.map { |x|
    visit x
  }.join(', ')})#{o.alias ? " AS #{visit o.alias}" : ''}"
end