title: Postgres group by day of month, ActiveRecord(Rails) returns array with nil ids while database query works fine
body: <p>I want to retrieve a single row corresponding to each day</p>
  
  <pre><code>result=Attendance.where("created_at &gt; ? and created_at &lt; ?",business_day_start,business_day_end).group("day").select("to_char(created_at,'DD') as day")
  </code></pre>
  
  <p>I use the above query on a model with columns created_at and user_id
    ActiveRecord gives me the following result</p>
  
  <pre><code>SELECT to_char(created_at,'DD') as day FROM "attendances" WHERE (created_at &gt; '2016-03-06 00:00:00.000000' and created_at &lt; '2016-03-09 23:59:59.999999') GROUP BY day
  [#&lt;Attendance:0x007f99fc469a40 id: nil&gt;, #&lt;Attendance:0x007f99fc469860 id: nil&gt;, #&lt;Attendance:0x007f99fc469590 id: nil&gt;]
  </code></pre>
  
  <p>But if I run the same query(obtained from above result) directly in the database(using pgAdmin), I get proper result with a column(day) and 3 rows in it<br>
  I am unable to understand where I am going wrong and why is active record returning an array of nil elements?</p>