From fa0f32d3cd0bc9fbc17ddfa5bbb699064c443c5c Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 30 Jul 2010 13:05:58 -0700 Subject: PERF: eliminating a case statement --- lib/arel/algebra/predicates.rb | 1 + lib/arel/algebra/relations/relation.rb | 9 +-------- 2 files changed, 2 insertions(+), 8 deletions(-) (limited to 'lib/arel') diff --git a/lib/arel/algebra/predicates.rb b/lib/arel/algebra/predicates.rb index 4920bc9713..9764c4cfa2 100644 --- a/lib/arel/algebra/predicates.rb +++ b/lib/arel/algebra/predicates.rb @@ -141,6 +141,7 @@ module Arel def to_sql(formatter = nil) "#{operand1.to_sql} #{predicate_sql} #{operand1.format(operand2)}" end + alias :value :to_sql end class CompoundPredicate < Binary diff --git a/lib/arel/algebra/relations/relation.rb b/lib/arel/algebra/relations/relation.rb index 9ff436ecb7..804ef5a09f 100644 --- a/lib/arel/algebra/relations/relation.rb +++ b/lib/arel/algebra/relations/relation.rb @@ -83,14 +83,7 @@ module Arel end def where_clauses - wheres.collect { |w| - case w - when Value - w.value - else # FIXME: why do we have to pass in a whereclause? - w.to_sql(Sql::WhereClause.new(self)) - end - } + wheres.map { |w| w.value } end def group_clauses -- cgit v1.2.3