diff options
Diffstat (limited to 'lib/arel/visitors/bind_visitor.rb')
-rw-r--r-- | lib/arel/visitors/bind_visitor.rb | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/lib/arel/visitors/bind_visitor.rb b/lib/arel/visitors/bind_visitor.rb index 0f1e38315b..c336e87395 100644 --- a/lib/arel/visitors/bind_visitor.rb +++ b/lib/arel/visitors/bind_visitor.rb @@ -6,19 +6,34 @@ module Arel super end - def accept node, &block + def accept node, collector, &block @block = block if block_given? super end private - def visit_Arel_Nodes_BindParam o + + def visit_Arel_Nodes_Assignment o, collector + if o.right.is_a? Arel::Nodes::BindParam + collector = visit o.left, collector + collector << " = " + visit o.right, collector + else + super + end + end + + def visit_Arel_Nodes_BindParam o, collector if @block - @block.call + val = @block.call + if String === val + collector << val + end else super end end + end end end |