Why this matters
Encryption reduces breach impact and supports data protection by design.
Encrypt sensitive columns (e.g., email, phone) with managed keys; ensure DB connection enforces TLS. Store only ciphertext; compare via deterministic token/hashes when needed. (GDPR Art. 32)
Encryption reduces breach impact and supports data protection by design.
Side-by-side examples engineers can pattern-match during review.
class User < ApplicationRecord
# plaintext email/phone
endclass User < ApplicationRecord
encrypts :email
encrypts :phone
end
# DATABASE_URL='postgres://...&sslmode=require'User.create!(email: params[:email]) # encrypted via encryptsUser.create!(email: params[:email]) # plaintext columnFrom the same buckets as this rule.