I have a situation where a myobject.save! is resulting in this error:
myobject.save!
PG::UniqueViolation: ERROR: duplicate key value violates unique constraint