Method: ActiveRecord::ConnectionAdapters::DatabaseStatements#to_sql

Defined in:
lib/active_record/connection_adapters/abstract/database_statements.rb

#to_sql(arel, binds = []) ⇒ Object

Converts an arel AST to SQL



10
11
12
13
14
15
16
17
18
19
# File 'lib/active_record/connection_adapters/abstract/database_statements.rb', line 10

def to_sql(arel, binds = [])
  if arel.respond_to?(:ast)
    binds = binds.dup
    visitor.accept(arel.ast) do
      quote(*binds.shift.reverse)
    end
  else
    arel
  end
end