Closed vitaliiorlov closed 9 months ago
It works with this code:
class Container
extend Dry::Container::Mixin
class Transaction
include Dry::Monads[:result]
def call(input, &block)
result = nil
ActiveRecord::Base.transaction do
result = block.call(Success(input))
raise ActiveRecord::Rollback if result.failure?
end
result
end
end
register "transaction", Transaction.new
end
It would be great to update the documentation. Thank you for the awesome Dry-family gems 😃
Describe the bug
Around step with ActiveRecord transaction does not work.
Getting this exception:
To Reproduce
Operation:
Container:
Expected behavior
It works as expected. (https://dry-rb.org/gems/dry-transaction/0.15/around-steps/)
My environment
lsb_release -a
No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04.3 LTS Release: 22.04 Codename: jammyruby:3.2.2-slim-bookworm
image