How do I use ActiveRecord to safely add-or-update the same unique row
in a table from multiple ruby processes?
Suppose I have a table called People with a column called ‘name’. In
the DB (which is MySql), the name column has a unique index on it.
Now, 2 ruby processes are chugging along adding rows in the People
table. These processes may (will) come across both new and existing
rows in the People table. I need to make sure that I don’t trigger a
“Mysql::Error: #23000Duplicate entry” error on the name column.