def to_s
      names = node.map do |child|
        if child.kind_of?(String) || child.kind_of?(Symbol)
          child.to_s
        elsif child.respond_to?(:name)
          child.name.to_s
        end
      end

      names.compact.uniq.join('_')
    end
def to_s
      names = node.map do |child|
        if child.kind_of?(String) || child.kind_of?(Symbol)
          child.to_s
        elsif child.respond_to?(:name)
          child.name.to_s
        end
      end

      names.compact.uniq.join('_')
    end
In Active Record 5, we don't *need* this class to make
 calculations work. They happily accept arel. However,
 when grouping with a calculation, there's a really,
 really weird alias name. It calls #to_s on the Arel.

 If this were not addressed, it would likely break query
 caching because the alias would have a unique name every
 time.