title: Rails 4: column reference "updated_at" is ambiguous with Postgres
body: <p>I am trying to query the database with a DateTime range for the '<code>updated_at</code>' field. The front end sends queries in a JSON array:</p>
  
  <pre><code>["2015-09-01 00:00:00","2015-10-02 23:00:00"]
  </code></pre>
  
  <p><strong>At the Rails controller, I parse the two strings to DateTime using:</strong></p>
  
  <pre><code>start_date = DateTime.parse(params[:date_range_arr][0])
  end_date = DateTime.parse(params[:date_range_arr][1])
  
  #...
  @events = @events.where('updated_at BETWEEN ? AND ?,
         start_date, end_date
  )
  </code></pre>
  
  <p><strong>The queries show:</strong></p>
  
  <pre><code>WHERE (updated_at BETWEEN '2015-09-01 00:00:00.000000' AND '2015-10-02 23:00:00.000000')
  </code></pre>
  
  <p><strong>And the errors are:</strong></p>
  
  <pre><code>ActionView::Template::Error (PG::AmbiguousColumn: ERROR:  column reference "updated_at" is ambiguous
  LINE 1: ...texts"."id" = "events"."context_id" WHERE (updated_at...
  </code></pre>