👩💻 Join our community of thousands of amazing developers!
PostgreSQL provides lots of column types and ActiveRecord maps some of them. One column type that I’m using more and more is uuid. The UUID has different implementations, but the most used version is v4. It generates random strings following the xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx format, where: x is hexadecimal digit. y can be one of 8, 9, A, or B. Let’s generate some identifiers using the uuidgen command. Note how they follow the specification I just mentioned. 847862BF-424C-482F-81B1-09A48...