diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-08-16 14:42:20 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-08-16 14:42:20 -0700 |
commit | d12580a7ee43dad449a1da208ec60c70c183d7ee (patch) | |
tree | 6272dfdc786d0705eb86e452fe80f46a020ef503 /lib/arel | |
parent | bd3ecd761e7b52eabf32efe2f5c4ad722423a623 (diff) | |
download | rails-d12580a7ee43dad449a1da208ec60c70c183d7ee.tar.gz rails-d12580a7ee43dad449a1da208ec60c70c183d7ee.tar.bz2 rails-d12580a7ee43dad449a1da208ec60c70c183d7ee.zip |
spec:v1:sqlite3 works for running our specs
Diffstat (limited to 'lib/arel')
-rw-r--r-- | lib/arel/attributes/attribute.rb | 4 | ||||
-rw-r--r-- | lib/arel/nodes.rb | 1 | ||||
-rw-r--r-- | lib/arel/nodes/in.rb | 6 | ||||
-rw-r--r-- | lib/arel/visitors/to_sql.rb | 4 |
4 files changed, 15 insertions, 0 deletions
diff --git a/lib/arel/attributes/attribute.rb b/lib/arel/attributes/attribute.rb index fdc64d62e0..ff17d6136c 100644 --- a/lib/arel/attributes/attribute.rb +++ b/lib/arel/attributes/attribute.rb @@ -4,6 +4,10 @@ module Arel def eq other Nodes::Equality.new self, other end + + def in other + Nodes::In.new self, other + end end class String < Attribute; end diff --git a/lib/arel/nodes.rb b/lib/arel/nodes.rb index 9dea981a06..d1868adfa9 100644 --- a/lib/arel/nodes.rb +++ b/lib/arel/nodes.rb @@ -1,4 +1,5 @@ require 'arel/nodes/equality' +require 'arel/nodes/in' require 'arel/nodes/sql_literal' require 'arel/nodes/select_core' require 'arel/nodes/select_statement' diff --git a/lib/arel/nodes/in.rb b/lib/arel/nodes/in.rb new file mode 100644 index 0000000000..6ccf37a053 --- /dev/null +++ b/lib/arel/nodes/in.rb @@ -0,0 +1,6 @@ +module Arel + module Nodes + class In < Equality + end + end +end diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb index 736c0ce77b..bb93876595 100644 --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -56,6 +56,10 @@ module Arel quote_table_name o.name end + def visit_Arel_Nodes_In o + "#{visit o.left} IN (#{o.right.map { |x| quote visit x }.join ', '})" + end + def visit_Arel_Nodes_Equality o "#{visit o.left} = #{quote visit o.right}" end |