My app sends out activation keys from a list of unassigned keys to  
customers. An appropriate model action in the activation key model  
would look something like this:

named_scope :available, :conditions => 'available IS NULL'

def fetch_available_key
        key = ActivationKey.available.first
        key.assigned = DateTime.now
        key.save
        return key
end

What's the best way to deal with concurrent requests in this  
situation? My deployment server uses passenger, the database is MySQL  
5.x.

Thanks,

Florian



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