Method: Arel::Nodes::Node#to_sql
- Defined in:
- activerecord/lib/arel/nodes/node.rb
#to_sql(engine = Table.engine) ⇒ Object
FIXME: this method should go away. I don’t like people calling to_sql on non-head nodes. This forces us to walk the AST until we can find a node that has a “relation” member.
Maybe we should just use Table.engine? :‘(
148 149 150 151 152 153 |
# File 'activerecord/lib/arel/nodes/node.rb', line 148 def to_sql(engine = Table.engine) collector = Arel::Collectors::SQLString.new engine.with_connection do |connection| connection.visitor.accept(self, collector).value end end |