Database unique constraints in Rails
TLDR
ActiveRecord uniqueness validations are not good enough for distributed systems. Instead, database-level unique constraints must be used. When they are, custom logic must be implemented on the Rails side to trap these errors and…