title: Rails Dates Time and Fixtures
body: <p>I had the following fixture:</p>
  
  <p></p>
  
  <pre><code>link_1:
    user: tom
    image: boy1
    created_at: &lt;%= 5.day.ago %&gt;
  </code></pre>
  
  <p>I tried the following request:</p>
  
  <pre><code>Links.where("Date(created_at) = ?", 5.day.ago.to_date)
  </code></pre>
  
  <p>Answer:</p>
  
  <pre><code>[]
  </code></pre>
  
  <p>grrrr....typing...typing...scratching...
  I finally tried:
  </p>
  
  <pre><code>link_1:
    user: tom
    image: boy1
    created_at: &lt;%= 5.day.ago.to_date %&gt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>Links.where("Date(created_at) = ?", 5.day.ago.to_date)
  </code></pre>
  
  <p>finally answers</p>
  
  <pre><code>[#&lt;Link id: 298486374, user_id: 1038054164, image_id: 482586125, created_at: "2010-11-28 00:00:00", updated_at: "2010-12-03 21:32:19"&gt;]
  </code></pre>
  
  <p>What I was expecting, but why did I need to put to_date? It is not clear to me, because when I create an object without specifying the creation date, I can select them with the following where clause without issue:</p>
  
  <pre><code>Links.where("Date(created_at) = ?", Date.today)
  </code></pre>
  
  <p>Any idea?</p>