

Using Masked Identifiers to Reference ActiveRecord Models - stevedewald
http://blog.matthodan.com/63159496

======
svanhess
Why not use a UUID? Seems wasteful to have to do a SELECT for every INSERT.

~~~
matthodan
I thought so too at first, but this way I can control the length of the unique
ID while still guaranteeing that every ID is unique. Clearly, if you decided
to have a 2 character masked identifier, you'd end up with a small number of
possible objects before problems start to happen. As a TODO, I need to
implement an elegant way to handle situations when all possible UIDs have been
exhausted. If you know of a good UUID lib that lets you control the length of
the UID, guarantees 100% unique codes, and gracefully handles issues when UIDs
have run out, let me know! I'd definitely consider replacing my CodeGenerator.

