src code

class method ActiveRecord.transaction

ActiveRecord.transaction(callback,[error_callback]) → null
  • proceed (Function): The block of code to execute inside the transaction.
  • error_callback (Function): Optional error handler that will be called with an exception if one is thrown during a transaction. If no error handler is passed the exception will be thrown.
ActiveRecord.transaction(function(){
    var from = Account.find(2);
    var to = Account.find(3);
    to.despoit(from.withdraw(100.00));
});