diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-08-08 23:23:51 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-08-08 23:23:51 +0100 |
commit | 79411322ae225289e1c051f4f68ed84c6349e4a0 (patch) | |
tree | 424499366dc9c7ced8a271756b86a865ce17c977 /lib/arel/tree_manager.rb | |
parent | 03b6ca269ac8dfec8f70f2b98439d45b873f9e97 (diff) | |
download | rails-79411322ae225289e1c051f4f68ed84c6349e4a0.tar.gz rails-79411322ae225289e1c051f4f68ed84c6349e4a0.tar.bz2 rails-79411322ae225289e1c051f4f68ed84c6349e4a0.zip |
Make it the responsibility of the connection to hold on to a visitor for generating SQL, rather than the TreeManager. (There is a related commit coming in Active Record.)
Diffstat (limited to 'lib/arel/tree_manager.rb')
-rw-r--r-- | lib/arel/tree_manager.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/arel/tree_manager.rb b/lib/arel/tree_manager.rb index 5722baca77..99a7164e2e 100644 --- a/lib/arel/tree_manager.rb +++ b/lib/arel/tree_manager.rb @@ -4,21 +4,23 @@ module Arel include Arel::Relation include Arel::FactoryMethods - attr_accessor :visitor attr_reader :ast, :engine def initialize engine - @engine = engine - @visitor = Visitors.visitor_for @engine - @ctx = nil + @engine = engine + @ctx = nil end def to_dot Visitors::Dot.new.accept @ast end + def visitor + engine.connection.visitor + end + def to_sql - @visitor.accept @ast + visitor.accept @ast end def initialize_copy other |