Alphanumeric id

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.

Thanks
-Will

You want to be careful not to couple the id of the record to business
logic. It is best for you to have another field to handle this; or
just have a method that returns this ticket identifier you are after.

On Sun, 2008-03-23 at 13:17 -0700, William Fawcett wrote:

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs