Module: SimpleAction::Transactable
- Extended by:
- ActiveSupport::Concern
- Included in:
- Service
- Defined in:
- lib/simple_action/concerns/transactable.rb
Instance Method Summary collapse
- #transaction { ... } ⇒ Object
- #transaction=(bool) ⇒ Object
- #transaction? ⇒ Boolean
- #transaction_options ⇒ Hash
Instance Method Details
#transaction { ... } ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/simple_action/concerns/transactable.rb', line 23 def transaction return unless block_given? if transaction? ActiveRecord::Base.transaction() do yield end else yield end end |
#transaction=(bool) ⇒ Object
35 36 37 |
# File 'lib/simple_action/concerns/transactable.rb', line 35 def transaction=(bool) @@transaction = !!bool end |
#transaction? ⇒ Boolean
40 41 42 |
# File 'lib/simple_action/concerns/transactable.rb', line 40 def transaction? defined?(@@transaction) ? @@transaction : true end |
#transaction_options ⇒ Hash
45 46 47 |
# File 'lib/simple_action/concerns/transactable.rb', line 45 def {} end |