diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-28 17:03:52 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-28 17:03:52 -0700 |
commit | d69949ed0d63ba19051a24cba992bd4655d0f5be (patch) | |
tree | cd221100013f75b2428bc081eabad668db30342e /activerecord | |
parent | 1c030a3c3c61d6d6262785bf67e1d8f44da87ea5 (diff) | |
download | rails-d69949ed0d63ba19051a24cba992bd4655d0f5be.tar.gz rails-d69949ed0d63ba19051a24cba992bd4655d0f5be.tar.bz2 rails-d69949ed0d63ba19051a24cba992bd4655d0f5be.zip |
Shouldn't have committed this! Revert "avoid calling to_sql twice"
This reverts commit 1c030a3c3c61d6d6262785bf67e1d8f44da87ea5.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index cba22c2207..0593897fa5 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -135,14 +135,11 @@ module ActiveRecord next if where.blank? case where - when Arel::Predicates::In - # FIXME: this needs to go away - # 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})")) + when Arel::SqlLiteral + arel = arel.where(where) else - arel = arel.where where + sql = where.is_a?(String) ? where : where.to_sql + arel = arel.where(Arel::SqlLiteral.new("(#{sql})")) end end |