See ActiveRecord::Transactions::ClassMethods for documentation.
Methods
- A
- R
- T
- W
Classes and Modules
Instance Public methods
Add the record to the current transaction so that the :after_rollback and :after_commit callbacks can be called.
Reset id and @new_record if the transaction rolls back.
# File activerecord/lib/active_record/transactions.rb, line 250 250: def rollback_active_record_state! 251: remember_transaction_record_state 252: yield 253: rescue Exception 254: IdentityMap.remove(self) if IdentityMap.enabled? 255: restore_transaction_record_state 256: raise 257: ensure 258: clear_transaction_record_state 259: end
See ActiveRecord::Transactions::ClassMethods for detailed documentation.
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 291 291: def with_transaction_returning_status 292: status = nil 293: self.class.transaction do 294: add_to_transaction 295: status = yield 296: raise ActiveRecord::Rollback unless status 297: end 298: status 299: end