title: Count not working on select with alias
body: <p>I have a scope called <strong>add_has_relation</strong> 
  that does a left join with another table and renames with AS a field like this:</p>
  
  <pre><code>scope :add_has_relation, lambda { |fan|
    joins("LEFT JOIN fan_influencers fi ON fi.influencer_id = influencers.id
      AND fi.fan_id = #{fan.id}").select('influencers.*', 'fi.id AS has_relation') if fan.present?
  }
  </code></pre>
  
  <p>If I use it, everything works great and I can use that field new field:</p>
  
  <blockquote>
    <p>Influencer.add_has_relation(Fan.find(2)).first.has_relation </p>
  </blockquote>
  
  <p>But if I use COUNT like this:</p>
  
  <blockquote>
    <p>Influencer.add_has_relation(Fan.find(2)).count</p>
  </blockquote>
  
  <p>It fails with <strong>StatementInvalid</strong> because for some reason it is running this query: </p>
  
  <blockquote>
    <p>SELECT COUNT(influencers.*, fi.id AS has_relation) FROM "inf...</p>
  </blockquote>
  
  <p>and so I have to use it like this:</p>
  
  <blockquote>
    <p>Influencer.add_has_relation(Fan.find(2)).map(&amp;:id).count</p>
  </blockquote>
  
  <p>But I don't think it is neat. Is there a better way to do it?</p>