Module: CycloneLariat::Outbox::Extensions::ActiveRecordOutbox

Defined in:
lib/cyclone_lariat/plugins/outbox/extensions/active_record_outbox.rb

Instance Method Summary collapse

Instance Method Details

#transaction(opts = {}, &block) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/cyclone_lariat/plugins/outbox/extensions/active_record_outbox.rb', line 7

def transaction(opts = {}, &block)
  opts = opts.dup
  return super unless opts.delete(:with_outbox)

  outbox = CycloneLariat::Outbox.new
  result = super(opts) do
    block.call(outbox)
  end

  outbox.publish
  result
end