Ecto's uniqueness constraint vs. Rails' uniqueness validation
germanvelasco.com
germanvelasco.com
I came here to mention that there is also the https://github.com/toptal/database_validations gem which allows you to handle uniqueness validations in Rails in a similar manner to Ecto.
It will still work exactly as expected if you provide the index name manually, even if it's not the same order as the constraint in the DB.