Module: Foobara::Entity::Concerns::Transactions::ClassMethods

Defined in:
foobara-0.0.110/projects/entity/src/concerns/transactions.rb

Instance Method Summary collapse

Instance Method Details

#current_transactionObject



12
13
14
# File 'foobara-0.0.110/projects/entity/src/concerns/transactions.rb', line 12

def current_transaction
  Foobara::Persistence.current_transaction!(self)
end

#current_transaction_tableObject



8
9
10
# File 'foobara-0.0.110/projects/entity/src/concerns/transactions.rb', line 8

def current_transaction_table
  Foobara::Persistence.current_transaction_table!(self)
end

#transaction(mode: nil, skip_dependent_transactions: false) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'foobara-0.0.110/projects/entity/src/concerns/transactions.rb', line 16

def transaction(mode: nil, skip_dependent_transactions: false, &)
  if skip_dependent_transactions
    entity_base.transaction(mode, &)
  else
    Foobara::Persistence.transaction(
      self, *deep_depends_on,
      mode:,
      &
    )
  end
end