evilmartians.com
One row, many threads: How to avoid database duplicates in Rails applications
Making sure each database row is unique, and tables contain no duplicates seems like a straightforward task in Rails. Active Record has a built-in validator that you can put on a model and call it a day. Until your application encounters high load and concurrent writes