rails/rails — pull request #9262 by dylanahsmith (2013-02-12 11:45:18+00:00)
Title: active_record: Fix regression in predicate builder for join aliases.

## Problem

Pull #9207 introduced a regression where the predicate builder causes an exception to be raised when trying to get the column for quoting integers when compared to an attribute on an aliased table.

## Solution

Takes the same approach as Arel, checking if the table exists, and otherwise passing a nil column to quote.

Relevant Arel code: https://github.com/rails/arel/blob/master/lib/arel/visitors/to_sql.rb#L144