diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-30 13:05:58 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-30 13:05:58 -0700 |
commit | fa0f32d3cd0bc9fbc17ddfa5bbb699064c443c5c (patch) | |
tree | 34f8b3e3ceb3604472d45db20e6779d0c8e6dd34 | |
parent | 53bfaedaca5387bbc27a4ce04ea47367aaf4401a (diff) | |
download | rails-fa0f32d3cd0bc9fbc17ddfa5bbb699064c443c5c.tar.gz rails-fa0f32d3cd0bc9fbc17ddfa5bbb699064c443c5c.tar.bz2 rails-fa0f32d3cd0bc9fbc17ddfa5bbb699064c443c5c.zip |
PERF: eliminating a case statement
-rw-r--r-- | lib/arel/algebra/predicates.rb | 1 | ||||
-rw-r--r-- | lib/arel/algebra/relations/relation.rb | 9 |
2 files changed, 2 insertions, 8 deletions
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 |