how to check if a record lock is in place

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.

thanks

nayeem

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