title: Safely escape strings for SQL fragments for joins, limits, selects, and so on (not conditions) on Rails
body: <p>In Ruby on Rails, for conditions, it's easy to make SQL-injection-proof queries:</p>
  
  <pre><code>:conditions =&gt; ["title = ?", title]
  </code></pre>
  
  <p>where title comes from the outside, from a web form or something like that.</p>
  
  <p>But what if you are using SQL fragments in other parts of the query, like:</p>
  
  <pre><code>:select =&gt; "\"#{title}\" AS title"   # I do have something like this in one instance
  :joins =&gt; ["LEFT JOIN blah AS blah2 ON blah2.title = \"#{title}\""]
  </code></pre>
  
  <p>Is there a way to properly escape those strings?</p>