2009/6/18 Developer In London <[email protected]>:
> does anyone know how i can check if a record has a lock in place before I
> attempt to lock the record?
>
> Eg
>
> # <-- check here if the specific record is already locked.
> # if not locked
> MyModel.lock!
> # else
> # skip to the next model.
>

I do not know whether this can be done, but I think that even if it
could it would not be safe.  In the gap between testing the lock and
attempting to lock it someone else could lock it themselves so you
would still have to deal with the consequences of attempting to lock
an already locked record.

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