method

with_lock

with_lock(lock = true)
public

Wraps the passed block in a transaction, locking the object before yielding. You pass can the SQL locking clause as argument (see lock!).