See ActiveRecord::Transactions::ClassMethods for documentation.
Add the record to the current transaction so that the :after_rollback and :after_commit callbacks can be called.
# File lib/active_record/transactions.rb, line 297 297: def add_to_transaction 298: if self.class.connection.add_transaction_record(self) 299: remember_transaction_record_state 300: end 301: end
Reset id and @new_record if the transaction rolls back.
# File lib/active_record/transactions.rb, line 268 268: def rollback_active_record_state! 269: remember_transaction_record_state 270: yield 271: rescue Exception 272: IdentityMap.remove(self) if IdentityMap.enabled? 273: restore_transaction_record_state 274: raise 275: ensure 276: clear_transaction_record_state 277: end
See ActiveRecord::Transactions::ClassMethods for detailed documentation.
# File lib/active_record/transactions.rb, line 249 249: def transaction(options = {}, &block) 250: self.class.transaction(options, &block) 251: end
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 lib/active_record/transactions.rb, line 309 309: def with_transaction_returning_status 310: status = nil 311: self.class.transaction do 312: add_to_transaction 313: status = yield 314: raise ActiveRecord::Rollback unless status 315: end 316: status 317: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.