He asked for unique it is true On Sep 23, 2011 9:03 AM, "Colin Law" <[email protected]> wrote: > On 23 September 2011 16:34, Curtis Schofield <[email protected]> wrote: >> The simple answer is it would be trivial to have ants have unique names use >> ant id. >> >> THe simples i can see is to use player.ant.count (select + update ) >> >> do a count of ants for player before each batch creation > > Using count will not work. Suppose there were three, numbers 1, 2 and > 3. Suppose number 2 is deleted leaving 1 and 3. If a new one were > created it would get 3 again if count were used. It is necessary to > find the current highest and increment that so the new one will be 4. > > Colin > >> >> I thought of 4 other ways but this is the simplest. >> >> On Sep 22, 2011 2:43 PM, "Romain 'Maz' BILLOIR" >> <[email protected]> wrote: >>> (Frenchy, sorry =)) >>> >>> Hi everyone, i'm working on a web browser based game: >>> every player have got some ants and i want every ants of each player >>> to have a unique name: >>> >>> Player 1: >>> ant 1 >>> ant 2 >>> ant 3 >>> Player 2: >>> ant 1 >>> ant 2 >>> ant 3 >>> ant 4 >>> ... >>> >>> To do that i need to create player1_seq and player2_seq and increment >>> the player sequence whenever the player create an ant so i need to >>> create sequence whenever a player subscribe. >>> >>> How to do that? >>> >>> Thanks. >>> >>> -- >>> 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 [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group at >>> http://groups.google.com/group/rubyonrails-talk?hl=en. >>> >> >> -- >> 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 [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. >> > > > > -- > gplus.to/clanlaw > > -- > 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 [email protected]. > To unsubscribe from this group, send email to [email protected]. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. >
-- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

