lib/ledgerizer/locking.rb
# Start a transaction, grab locks on the given accounts, then call the block
# from within the transaction.
#
# If any account can't be locked (because there isn't a corresponding account
# balance record), don't call the block, and return false.
Start a transaction, grab locks on the given accounts, then call the block
from within the transaction.

If any account can't be locked (because there isn't a corresponding account
balance record), don't call the block, and return false.
Start a transaction grab locks on the given accounts then call the block from within the transaction . If any account can ' t be locked ( because there isn ' t a corresponding account balance record ) don ' t call the block and return false .
def lock_and_call
        locks_succeeded = nil
        Ledgerizer::Account.restartable_transaction do
          locks_succeeded = Ledgerizer::Account.with_restart_on_deadlock { grab_locks }
          if locks_succeeded
            begin
              yield
            ensure
              remove_locks
            end
          end
        end
        locks_succeeded
      end
def lock_and_call locks_succeeded = nil Ledgerizer :: Account . restartable_transaction do locks_succeeded = Ledgerizer :: Account . with_restart_on_deadlock { grab_locks } if locks_succeeded begin yield ensure remove_locks end end end locks_succeeded end
Start a transaction, grab locks on the given accounts, then call the block
from within the transaction.
Start a transaction grab locks on the given accounts then call the block from within the transaction .