On Apr 21, 2009, at 5:16 , Ryan Felton wrote:

> I'm currently working on a project where I need a generated unique
> identifier for an order and to not use the traditional database
> primary key of id. So instead of the traditional /orders/1 it would be
> something obscure like /orders/52312492.
>
> The UUID gem's shortest id is 32 characters and seems a quite lengthy.
> My initial thought is to use Time.now.to_i.to_s + order.id for the
> identifier, which would yield something like "12403160401", but I was
> wondering if anyone had any better approaches?

Why not just generate a UUID and chop off as much as you need?


--~--~---------~--~----~------------~-------~--~----~
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
-~----------~----~----~----~------~----~------~--~---

Reply via email to