1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Shouldn't have committed this! Revert "avoid calling to_sql twice"

This reverts commit 1c030a3c3c.
This commit is contained in:
Aaron Patterson 2010-07-28 17:03:52 -07:00
parent 1c030a3c3c
commit d69949ed0d

View file

@ -135,14 +135,11 @@ module ActiveRecord
next if where.blank? next if where.blank?
case where case where
when Arel::Predicates::In when Arel::SqlLiteral
# FIXME: this needs to go away arel = arel.where(where)
# when an IN is part of a larger query, the SQL seems to be different
arel = arel.where(Arel::SqlLiteral.new("(#{where.to_sql})"))
when String
arel = arel.where(Arel::SqlLiteral.new("(#{where})"))
else else
arel = arel.where where sql = where.is_a?(String) ? where : where.to_sql
arel = arel.where(Arel::SqlLiteral.new("(#{sql})"))
end end
end end