Reputation: 2131
Do ActiveRecord locks only work when they are inside of a transaction? If I open up two rails consoles and find a record then call lock!
on that record I can still access the record from the other console.
Upvotes: 4
Views: 873
Reputation: 4657
According to the docs, lock!
does not include a transaction. with_lock
does, though, and should prevents you from writing to (but not reading from) the locked record.
Upvotes: 2