Any idea how to make this work?
require "dry/container" module Core class Container extend Dry::Container::Mixin register("transaction") do |input, &block| result = nil begin ActiveRecord::Base.transaction do result = block.call(Dry::Monads::Success(input)) raise ActiveRecord::Rollback if result.failure? result end rescue ActiveRecord::Rollback require "pry"; binding.pry result end end end end
I'm getting the following error:
Dry::Transaction::InvalidResultError: step +transaction+ must return a Result object
I guess because the
ActiveRecord::Rollback is not being rescued.
dry-validation... is it possible to export a JSON schema file based on a dry schema? I find the dry/ruby stuff much easier to read but my work still depends on JSON schemas