aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-09-28 17:31:31 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-09-28 17:31:31 -0700
commit8d9f7b5b9987cccd392442b92c3945fc20a12fff (patch)
treea2abf3856d2f15a91f303b51ce0b32c88d6c1bbc /activerecord/lib
parentb50b1ef9e8ea33c8fb3fa1cac915baca64edfbea (diff)
downloadrails-8d9f7b5b9987cccd392442b92c3945fc20a12fff.tar.gz
rails-8d9f7b5b9987cccd392442b92c3945fc20a12fff.tar.bz2
rails-8d9f7b5b9987cccd392442b92c3945fc20a12fff.zip
SqlLiteral is a string, so we can dry up these conditionals
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/relation/query_methods.rb7
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