Sha256: 609257f7c5eda6c836596985c589fe3864f832b246037be0d09e61c8d54d555b

Contents?: true

Size: 454 Bytes

Versions: 5

Compression:

Stored size: 454 Bytes

Contents

# frozen_string_literal: true

module CycloneLariat
  class Outbox
    module Extensions
      module ActiveRecordOutbox
        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
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cyclone_lariat-1.0.0 lib/cyclone_lariat/plugins/outbox/extensions/active_record_outbox.rb
cyclone_lariat-1.0.0.rc9 lib/cyclone_lariat/plugins/outbox/extensions/active_record_outbox.rb
cyclone_lariat-1.0.0.rc8 lib/cyclone_lariat/plugins/outbox/extensions/active_record_outbox.rb
cyclone_lariat-1.0.0.rc7 lib/cyclone_lariat/plugins/outbox/extensions/active_record_outbox.rb
cyclone_lariat-1.0.0.rc6 lib/cyclone_lariat/plugins/outbox/extensions/active_record_outbox.rb