Module: Workflow::Transactional

Defined in:
lib/workflow/transactional.rb

Instance Method Summary collapse

Instance Method Details

#halt_with_rollback!(reason = nil) ⇒ Object

Raises:

  • (ActiveRecord::Rollback)


17
18
19
20
# File 'lib/workflow/transactional.rb', line 17

def halt_with_rollback!(reason = nil)
  halt reason
  raise ActiveRecord::Rollback
end

#new_transactionObject



11
12
13
14
15
# File 'lib/workflow/transactional.rb', line 11

def new_transaction
  self.class.transaction(:requires_new => true) do
    yield
  end
end

#process_event!(*args) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/workflow/transactional.rb', line 22

def process_event!(*args)
  return_value = :unprocessed
  self.new_transaction do
    return_value = super(*args)
#         raise ActiveRecord::Rollback if self.halted?
  end
  return return_value == :unprocessed ? false : return_value
end