Class: Arel::Visitors::ToSql

Inherits:
Object
  • Object
show all
Defined in:
lib/postgres_ext/arel/visitors/to_sql.rb

Instance Method Summary collapse

Instance Method Details

#visit_Array(o, a) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/postgres_ext/arel/visitors/to_sql.rb', line 6

def visit_Array o, a
  column = a.relation.engine.connection.columns(a.relation.name).find { |col| col.name == a.name.to_s } if a
  if column && column.respond_to?(:array) && column.array
    quoted o, a
  else
    o.empty? ? 'NULL' : o.map { |x| visit x }.join(', ')
  end
end