diff options
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index 762ae8e2a4..182c293d30 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -176,11 +176,10 @@ module ActiveRecord (@where_values - ['']).uniq.each do |where| case where - when Arel::SqlLiteral - arel = arel.where(where) + when String + arel = arel.where(Arel.sql("(#{where})")) else - sql = where.is_a?(String) ? where : where.to_sql(table.engine) - arel = arel.where(Arel::SqlLiteral.new("(#{sql})")) + arel = arel.where(Arel::Nodes::Grouping.new(where)) end end |