Validate Me! - Demystifying Rails Validators
summary
Shows that ComparisonValidator merged into Rails and that custom validators can live in app, lib, gem, or Rails itself; explains validators registered via validates/validates_with into model._validators but run later via valid/save callbacks; details options like allow_nil, allow_blank, message, if/unless, on, strict; highlights that validators live in ActiveModel not ActiveRecord so uniqueness validator has race conditions and DB constraints still require unique indexes; demonstrates how to implement validate_each.
AI-written summary · about
chapters (12)
- 0:00Rails validators intro
- 1:08Standard validator helpers
- 3:38Presence validator deep dive
- 6:22Active Model vs Active Record
- 8:51Standard library validators
- 10:59Validations and database
- 12:24How validates method works
- 14:49When validations trigger
- 16:37Purpose and limits of validations
- 18:43Custom validators in Rails
- 21:11Where to place custom validators
- 23:17Acknowledgments
related talks
31mOff the Rails: Validating non-model classes with…ActiveModel?
44mDo You Need That Validation? Let Me Call You Back About It
26mHow to Upstream Your Code to Rails
40mTricks That Rails Didn't Tell You About
26mDon't Rewrite Your Framework
31mWhat Comes After MVC
36mRails: Shadow Facets of Concurrency
31mActiveSupport and ActiveModel
