2 Matching Annotations
- Feb 2023
-
github.com github.com
-
guides.rubyonrails.org guides.rubyonrails.org
-
If you already have an instance of your model, you can start a transaction and acquire the lock in one go using the following code: book = Book.first book.with_lock do # This block is called within a transaction, # book is already locked. book.increment!(:views) end
-