title: Optional time where clause
body: <p>I have an optional time where clause.</p>
  
  <p>Namely <code>where('created_at &lt; ?', params[:infinite_scroll_time_buffer])</code>.</p>
  
  <p>This is included in a series of calls.</p>
  
  <p>I realized that <code>where</code> could take a hash, and if the hash is empty, or is missing any attributes, they won't be included. This sounds great, as I could avoid checking if the <code>params[:infinite_scroll_time_buffer]</code> is there, and just include the <code>where</code> clause and let Rails take care of the rest.</p>
  
  <p>The problem is the following:</p>
  
  <pre><code>def action
    options = {}
    options[:created_at] = params[:infinite_scroll_time_buffer]
  
    Post.method.another_method.where(options).another_method
  end
  </code></pre>
  
  <p>That would work, except the SQL Query checks that <code>post.created_at = ?</code> instead of <code>post.created_at &lt; ?</code> (rightfully so).</p>
  
  <p>I could have a range of times, but I can't for the life of me find a way for Time to reference the beginning of all time, or something like <code>Time::THE_BEGINNING_OF_EVERYTHING_AS_WE_KNOW_IT_DUN_DUN_DUN</code></p>
  
  <p>so that I could then have a range from that to the <code>params[:infinite_scroll_time_buffer]</code>. Is there another way to accomplish this? </p>