title: How to validate uniqueness for a certain time period
body: <p>I want to validate that a value is unique but only for the previous week.</p>
  
  <p>The rails guide gives the following example to add a condition:</p>
  
  <pre><code>validates_uniqueness_of :title, conditions: -&gt; { where.not(status: 'archived') }
  </code></pre>
  
  <p>I tried to modify it so that it only checks the last 7 days:</p>
  
  <pre><code>validates_uniqueness_of :title, conditions: -&gt; { where(created_at: 7.days.ago..DateTime.now) }
  </code></pre>
  
  <p>It is still checking all records and not just the last 7 days.</p>