Skip to content

Commit

Permalink
Shouldn't have committed this! Revert "avoid calling to_sql twice"
Browse files Browse the repository at this point in the history
This reverts commit 1c030a3.
  • Loading branch information
tenderlove committed Jul 29, 2010
1 parent 1c030a3 commit d69949e
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions activerecord/lib/active_record/relation/query_methods.rb
Expand Up @@ -135,14 +135,11 @@ def build_arel
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


Expand Down

0 comments on commit d69949e

Please sign in to comment.