aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/attributes
diff options
context:
space:
mode:
authorErnie Miller <ernie@metautonomo.us>2010-09-29 12:54:13 -0400
committerErnie Miller <ernie@metautonomo.us>2010-09-29 12:54:13 -0400
commit261d284136567edfeb4dbfd9403ebd95e6bdae75 (patch)
tree7de52f16f8915dd0277ca8434b19127d4c700c7d /lib/arel/attributes
parentd68165501fc80bbce34c43eaaf48381bcca27c15 (diff)
downloadrails-261d284136567edfeb4dbfd9403ebd95e6bdae75.tar.gz
rails-261d284136567edfeb4dbfd9403ebd95e6bdae75.tar.bz2
rails-261d284136567edfeb4dbfd9403ebd95e6bdae75.zip
Add eq_any.
Diffstat (limited to 'lib/arel/attributes')
-rw-r--r--lib/arel/attributes/attribute.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/arel/attributes/attribute.rb b/lib/arel/attributes/attribute.rb
index e1f7fd81d2..b5698a3f1d 100644
--- a/lib/arel/attributes/attribute.rb
+++ b/lib/arel/attributes/attribute.rb
@@ -11,6 +11,14 @@ module Arel
Nodes::Equality.new self, other
end
+ def eq_any others
+ first = Nodes::Equality.new self, others.shift
+
+ Nodes::Grouping.new others.inject(first) { |memo,expr|
+ Nodes::Or.new(memo, Nodes::Equality.new(self, expr))
+ }
+ end
+
def in other
case other
when Arel::SelectManager