diff options
Diffstat (limited to 'lib/arel/compatibility')
-rw-r--r-- | lib/arel/compatibility/wheres.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/arel/compatibility/wheres.rb b/lib/arel/compatibility/wheres.rb new file mode 100644 index 0000000000..eeb7a2fa38 --- /dev/null +++ b/lib/arel/compatibility/wheres.rb @@ -0,0 +1,29 @@ +module Arel + module Compatibility # :nodoc: + class Wheres # :nodoc: + include Enumerable + + module Value # :nodoc: + attr_accessor :visitor + def value + visitor.accept self + end + end + + def initialize engine, collection + @engine = engine + @collection = collection + end + + def each + to_sql = Visitors::ToSql.new @engine + + @collection.each { |c| + c.extend(Value) + c.visitor = to_sql + yield c + } + end + end + end +end |