Cathal O'Riordan wrote:
> Could you provide an example of how this would work?

Take a look at :counter_cache at 
http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html.

Wrap everything up in a transaction, fetch the registration count, 
administer the new registration and update the counter cache. Any 
concurrent registrations will be rolled back by the database -- don't 
forget to catch that exception and deal with it.

--
Roderick van Domburg
http://www.nedforce.com
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to