I\'m having a problem with a Ruby heredoc i\'m trying to make. It\'s returning the leading whitespace from each line even though i\'m including the - operator, which is supp
Note: As @radiospiel pointed out, String#squish is only available in the ActiveSupport context.
I believe ruby's String#squish is closer to what you're really looking for:
Here is how I would handle your example:
def distinct_count
<<-SQL.squish
SELECT
CAST('#{name}' AS VARCHAR(30)) as COLUMN_NAME,
COUNT(DISTINCT #{name}) AS DISTINCT_COUNT
FROM #{table.call}
SQL
end