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 received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---