This page cannot be shown here. You can still read it on the original site — the toolbar below keeps your place in the directory.
A few years ago I inherited a codebase where the users table had no unique constraint on email. The model had validates :email, uniqueness: true, so everything seemed fine—until I found 847 duplicate email addresses in production. Someone had written a rake task. It bypassed ActiveRecord. The model validation never ran, and the database didn’t care. Nearly a thousand users couldn’t log in because…
Read on /posts/database-constraints-first-validations-second/ ↗
Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.