Permalink
Browse files

SqlLiteral is a string, so we can dry up these conditionals

  • Loading branch information...
tenderlove committed Sep 29, 2010
1 parent e080144 commit a35c8c6426b2219946658f8be9f95122dbe16a5f
Showing with 3 additions and 4 deletions.
  1. +3 −4 activerecord/lib/active_record/relation/query_methods.rb
@@ -177,11 +177,10 @@ def build_arel
(@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

0 comments on commit a35c8c6

Please sign in to comment.