module Activerecord::Transactionable
SRP: Provides an example of correct behavior for wrapping transactions. NOTE: Rails' transactions are per-database connection, not per-model, nor per-instance,
see: http://api.rubyonrails.org/classes/ActiveRecord/Transactions/ClassMethods.html
Constants
- DEFAULT_ERRORS_PREPARE_ON_SELF_INSIDE
- DEFAULT_ERRORS_PREPARE_ON_SELF_OUTSIDE
- DEFAULT_ERRORS_TO_HANDLE_INSIDE_TRANSACTION
- DEFAULT_ERRORS_TO_HANDLE_OUTSIDE_TRANSACTION
- DEFAULT_NUM_RETRY_ATTEMPTS
- ERRORS_TO_DISALLOW_INSIDE_TRANSACTION
These errors (and possibly others) will invalidate the transaction (on PostgreSQL and possibly other databases). This means that if you did rescue them inside a transaction (or a nested transaction) all subsequent queries would fail.
- INSIDE_CONTEXT
- INSIDE_TRANSACTION_ERROR_HANDLERS
- OUTSIDE_CONTEXT
- OUTSIDE_TRANSACTION_ERROR_HANDLERS
- REQUIRES_NEW
- TRANSACTION_METHOD_ARG_NAMES
- VERSION
Public Instance Methods
transaction_wrapper(**args) { |is_retry| ... }
click to toggle source
# File lib/activerecord/transactionable.rb, line 54 def transaction_wrapper(**args) self.class.transaction_wrapper(object: self, **args) do |is_retry| yield is_retry end end