Class Vapor::Transaction
In: vapor/transaction.rb
Parent: Object

The Transaction object controls initiation and completion or abortion of transactons. Will raise a StaleTransactionError on all methods except begin(), if no transaction is currently active.

Methods
abort    active?    begin    commit    committer=    do    log_entry    message=    rollback   
Attributes
persistence_manager  [R] 

Returns PersistenceManager instance associated with this Transaction

Included modules
Vapor::Exceptions
Public Instance methods
active?()

Returns true if a transaction if currently active.

begin()

Start a transaction. Raises a NestedTransactionError if an unfinished transaction is currently active.

commit()

Commit the currently active transaction to the Repository. Raises a StaleTransactionError if there is no active transaction or a CommitError (or one of it’s childclasses) if an error occurs.

rollback()

Abort the currently active transaction and restore all values of persistent objects to the values in the datastore. Persistent objects in the NEW state will become TRANSIENT again, losing their persistent identity. Raises an TransactionAbortedError when the transaction is occuring inside a block.

This method is also aliased as abort
abort()

Alias for rollback

do() {|self| ...}

Begin a transaction and commit it when the block terminates. If any exception is raised by the block, the transaction is automatically rolledback by calling abort and the exception re-raised. Raises a NestedTransactionError if the ransaction is already active.

log_entry()

TransactionLog holding information about the current transaction.

committer=( committer )

Set committer for all transactions committed hereafter.

message=( message )

Set log message for currently active transaction. Will be cleared when a new transaction is started. Raises a StaleTransactionError unless a transaction is currenlty active.