title: Rails database query - is it possible to give a column an alias?
body: <p>I've got to produce a json feed for an old mobile phone app and some of the labels need to be different from my database column names.</p>
  
  <p>I think the most efficient way of doing this would be to do a create an alias at the database level. So I'm doing things like</p>
  
  <pre><code>Site.where( mobile_visible: true ).select("non_clashing_id AS clientID")
  </code></pre>
  
  <p>which produces the SQL</p>
  
  <pre><code>SELECT non_clashing_id AS clientID FROM `sites` WHERE `sites`.`mobile_visible` = 1 ORDER BY site_name
  </code></pre>
  
  <p>If I run this query in MYSQL workbench it produces a column with the heading <code>ClientID</code> as I expect, with the required values.</p>
  
  <p>But if I show the object in a rails view I get <code>{"clientID":null},{"clientID":null},{"clientID":null}</code></p>
  
  <p>What am I doing wrong?  Is there a better way of doing this?</p>