I have some SQL queries that can’t conveniently be done in ActiveRecord or Arel. Some of these queries have long lines. For the sake of my logs, it seems like it would be preferable to have the query compacted without line breaks, but when looking at the query for editing/comprehension, it is advantageous to have the query broken out into pieces. I have two questions:
- Is there a good set of style guidelines anyone uses for how to break a SQL query up?
- Should I be doing something like gsub-ing the line breaks out to make the query compact when it gets run?