Ruby On Rails uses validations to ensure that models match expectations before being saved to the database.
However, there are some areas where Rails and the database may have race conditions. These cause unexpected data, invalid models, and tricky bugs.
http://izumi.plan99.net/blog/index.php/2008/09/20/validates_uniqueness_of-does-not-guarantee-uniqueness/ validates_uniqueness_of does not guarantee uniqueness
http://1rad.wordpress.com/2008/09/29/0x04-atomic-science/ find_or_create_by: think twice before you race
http://www.ruby-forum.com/topic/154078 Rails validation is inefficient
http://techblog.floorplanner.com/2009/11/17/case-insensitive-validates_uniqueness_of-slowness/ Case-insensitive validates_uniqueness_of slowness