I've done the same with great success.. I'd add a UNIQUE constraint on the
column too just to be extra sure..

On Tue, Apr 21, 2009 at 8:16 AM, Ryan Felton <[email protected]> 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?
>
> Thanks,
> Ryan
>
>
> >
>

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

Reply via email to