Module: Generalis::Transaction::Preparation
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/generalis/transaction/preparation.rb
Instance Method Summary collapse
-
#prepare ⇒ Boolean
Runs a one-time setup action for the transaction.
- #prepared? ⇒ Boolean
Instance Method Details
#prepare ⇒ Boolean
Runs a one-time setup action for the transaction.
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/generalis/transaction/preparation.rb', line 25 def prepare return true if prepared? @prepared = true run_callbacks(:prepare) do self.class.preparations.each do |preparation| instance_exec(&preparation) end end @prepared end |
#prepared? ⇒ Boolean
40 41 42 |
# File 'lib/generalis/transaction/preparation.rb', line 40 def prepared? persisted? || @prepared end |