title: Getting error "function week(timestamp without time zone) does not exist"
body: <p>I was following this example <a href="https://stackoverflow.com/questions/3641290/how-do-i-change-the-records-being-displayed-on-the-page-with-buttons-on-the-page/3641430#3641430">How do I change the records being displayed on the page with buttons on the page (RoR)</a> and managed to get the Daily filter working but when trying to set it up for the Weekly filter I get the error
  PG::Error: ERROR: function week(timestamp without time zone) does not exist</p>
  
  <p>I figured the WEEK function should work automatically as the DATE function did but that's not the case.</p>
  
  <p>model</p>
  
  <pre><code>def self.popularToday
      reorder('votes desc').find_with_reputation(:votes, :all, { :conditions =&gt; ["DATE(microposts.created_at) = DATE(NOW())"]})
  end
  def self.popularWeekly
      reorder('votes desc').find_with_reputation(:votes, :all, { :conditions =&gt; ["WEEK(microposts.created_at) = WEEK(NOW())"]})
  end
  </code></pre>
  
  <p>index.html.erb</p>
  
  <pre><code>&lt;form action="" method="get"&gt;
    &lt;fieldset&gt;
       &lt;button type="submit" name="show" value="daily"&gt;Today&lt;/button&gt;
       &lt;button type="submit" name="show" value="weekly"&gt;This week&lt;/button&gt;
    &lt;/fieldset&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>controller</p>
  
  <pre><code>when "daily"
            Kaminari.paginate_array(Micropost.popularToday).page(params[:page]).per(25)
  when "weekly"
            Kaminari.paginate_array(Micropost.popularWeekly).page(params[:page]).per(25)
  </code></pre>