On 8 February 2012 07:12, Bob Smith <bsm...@gmail.com> wrote: > I need a way to set a counter that will show how many of the model > have been created and put this in each instance. This will allow me to > use the record number as an input to another field before id is set. > After things are settled, the real id number can be substituted for > the counter.
If you do that and two users come along at the same time and make new objects then they will both get the same number. Can you not just use a before_save filter to set the field? If you think not can you explain what you are trying to do (and why) in more detail as there is almost certainly a better solution. Colin -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.