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:
parent
1c030a3c3c
commit
d69949ed0d
1 changed files with 4 additions and 7 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue