title: What is the easiest way to query for a date in a range using Rails 4 and postgres?
body: <p>I'm trying to select all records with a created_by attribute in a date range:</p>
  
  <pre><code>@start = params[:start].to_datetime
  @end = params[:end].to_datetime
  @registrations = Registration.where("created_at &gt;= #{ @start } and created_at &lt;= #{ @end }")
  </code></pre>
  
  <p>But I get an error from postgres that says:</p>
  
  <pre><code>PG::Error: ERROR:  syntax error at or near "T00"
  LINE 1: ...M "registrations"  WHERE (created_at &gt;= 2013-06-01T00:00:00+...
  </code></pre>
  
  <p>I've been searching on this one, but Google isn't coming through this time...</p>