Ecto's uniqueness constraint vs Rails' uniqueness validation
I really like how Ecto’s uniqueness constraints integrate with our database’s unique index. Having come from Rails, it was a pleasant surprise to know we could use the power of database constraints from within our app.
With Rails, we can add uniqueness validations, but there’s always a chance we’ll have race conditions. So, it always felt like a somewhat incomplete solution. Ecto solves that nicely by rescuing the database error and turning it into a nice error message.
✍️ https://www.germanvelasco.com/blog/ecto-uniqueness-constraint-vs-rails-uniqueness-validation
Read next ThinkingElixir 099: Slipstream and Tree-Sitter with Michael Davis