title: Using uniq in ActiveRecord
body: <p>Running this line of code</p>
  
  <pre><code>Activity.uniq.select(:ip).where("created_at &gt; NOW() - INTERVAL 1 DAY").count
  </code></pre>
  
  <p>Returns the number of all lines (without the uniquness filter) although the SQL is correct (with the DISTINCT keyword)</p>
  
  <p>If I run this command in 2 steps:</p>
  
  <pre><code>c = Activity.uniq.select(:ip).where("created_at &gt; NOW() - INTERVAL 1 DAY")
  c.size
  </code></pre>
  
  <p>Then I get the right count.</p>
  
  <p>How can it be?</p>
  
  <p>Thank you</p>