See ActiveRecord::Transactions::ClassMethods for documentation.
Namespace
Methods
- A
- R
- T
- W
Constants
ACTIONS | = | [:create, :destroy, :update] |
Instance Public methods
add_to_transaction()
Link
Add the record to the current transaction so that the
after_rollback
and after_commit
callbacks can be
called.
rollback_active_record_state!()
Link
Reset id and @new_record if the transaction rolls back.
transaction(options = {}, &block)
Link
See ActiveRecord::Transactions::ClassMethods for detailed documentation.
with_transaction_returning_status()
Link
Executes method
within a transaction and captures its return
value as a status flag. If the status is true the transaction is committed,
otherwise a ROLLBACK is issued. In any case the status flag is returned.
This method is available within the context of an ActiveRecord::Base instance.
# File activerecord/lib/active_record/transactions.rb, line 321 def with_transaction_returning_status status = nil self.class.transaction do add_to_transaction begin status = yield rescue ActiveRecord::Rollback @_start_transaction_state[:level] = (@_start_transaction_state[:level] || 0) - 1 status = nil end raise ActiveRecord::Rollback unless status end status end