[Rails] Re: how to create pgsql sequence from controller?
I agree Colin, i can't use count...
and i can't use ant's id because every ants of every players got a
unique id, so, this may be possible:
Player 1:
ant 1, id = 1
ant 2, id = 2
ant 3, id = 5
Player 2:
ant 1, id = 3
ant 2, id = 4
ant 3, id = 6
ant 4, id = 7.
And the Colin's solution isn't good too, suppose:
Player 1:
ant 1, id = 1, name = 1
ant 2, id = 2, name = 2
ant 3, id = 3, name = 3
Player2 subscribe and create 3ants:
on the first ant's creation i just put the name to 1 and the twice
follower just got the previously name+1, so:
ant 1, id = 4, name = 1
ant 2, id = 5, name = 2
ant 3, id = 6, name = 3
Player1 attacks Player2. The Player2's ant which has got the id = 6,
name = 3 dies.
Player2 creates a new ant the "highest number for that player's ants"
will be the ant which has got the id = 5, name = 2 so the next name
will be 3. Again.
Is there noway to create sequence from controller? I can also just set
a new column with the last used name. But i don't want my ant's table
to be "BIG"(don't know how to say clearly what i don't want).
--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home