[3.0] active_record: Quote numeric values compared to string columns.

This is a backport of pull #9207 to rails 3.0