Module: ActiveRecordUpsert::Arel::Visitors::MySQL

Defined in:
lib/active_record_upsert/arel/visitors/mysql.rb

Instance Method Summary collapse

Instance Method Details

#visit_Arel_Nodes_InsertStatement(obj, collector) ⇒ Object

rubocop:disable Naming/MethodName



5
6
7
8
9
10
11
# File 'lib/active_record_upsert/arel/visitors/mysql.rb', line 5

def visit_Arel_Nodes_InsertStatement(obj, collector) # rubocop:disable Naming/MethodName
  collector = super(obj, collector)
  return collector unless obj.on_duplicate

  collector << ' ON DUPLICATE KEY UPDATE'
  maybe_visit(obj.on_duplicate.expr, collector)
end