Hi I have the following scenario: A company has an account. Each account has many users. Users can make posts. Posts will obviously have an .id field that autoincrements. However, I want a field, say post_number, that increments within the :scope => :account_id, so all the posts within a company has numbers that follow on each other. Problem. Two users from the same account could be posting at the same time. I need a way to make sure the post_number is unique for each account and increments from 1. If you are using a mysql database - what would be the best way of doing this? Would you have to do the saving within a transaction? Regards Ivor --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---