Have you decided to use universally unique identifiers instead of auto incrementing integers for primary keys in your database table?
You can generate those UUID’s using SecureRandom.uuid
=> SecureRandom.uuid
"7c8fdaa5-830e-44e0-9a8c-d9785ed60802"
Tip: I cover creating a table with a non-id primary key in this post.
If you need to exchange a unique identifier with another system, there is another method to handle that, SecureRandom.urlsafe_base64
. To learn more about URL safe strings, you can check out this Stack Overflow answer.
=> SecureRandom.urlsafe_base64
"mEUXmeXenXUiCNI69xULbQ"