Re: ****[Rails] alphanumeric id

Craig White
Mon, 24 Mar 2008 01:50:07 -0000

On Sun, 2008-03-23 at 13:17 -0700, William Fawcett
wrote:
> I am working on a ticketing system, and the client has requested a
> special format for a ticket id the format would be alphanumeric with a
> 3 character client tag, date, then a incremental number for the day,
> for example
>
> ticket1 = ''joe_03232008_00001''
> ticket2 = ''joe_03232008_00002''
> ticket3 = joe_03242008_00001''
> etc
>
> is there any way to get rails to allow custom formatted id''s?
also, is
> this going to add alot of overhead? I can expect as many as 5000
> tickets per day. Is indexing going to become a problem?
>
> BTW: I am working on a system that is coded in Rails 1.2.3, I
can''t
> upgrade to 2.0 right now so the solution needs to be compatible.
----
make you life easy...

have a primary key the standard numerical id field
have a secondary key, assembled in whatever fashion you choose

That way, you give the customer what he wants yet you preserve sanity...

Craig