diff options
Diffstat (limited to 'activerecord/lib')
-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 |