Module: ActiveRecordCompose::TransactionSupport

Extended by:
ActiveSupport::Concern
Included in:
Model
Defined in:
lib/active_record_compose/transaction_support.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.after_commit(*args, &block) ⇒ void

Registers a block to be called after the transaction is fully committed.



51
52
53
54
# File 'lib/active_record_compose/transaction_support.rb', line 51

def after_commit(*args, &block)
  set_options_for_callbacks!(args, prepend_option)
  set_callback(:commit, :after, *args, &block)
end

.after_rollback(*args, &block) ⇒ void

Registers a block to be called after the transaction is rolled back.



58
59
60
61
# File 'lib/active_record_compose/transaction_support.rb', line 58

def after_rollback(*args, &block)
  set_options_for_callbacks!(args, prepend_option)
  set_callback(:rollback, :after, *args, &block)
end

Instance Method Details

#save(**options) ⇒ void



103
# File 'lib/active_record_compose/transaction_support.rb', line 103

def save(**options) = with_transaction_returning_status { super }

#save!(**options) ⇒ void



105
# File 'lib/active_record_compose/transaction_support.rb', line 105

def save!(**options) = with_transaction_returning_status { super }