Support for Ruby 3.1

Hello there,

We really love and depend on dry-transaction for a few of our features at work. Thanks for all the work you have put into it.

I’m working on our Ruby 3.1 upgrade and noticed my controllers that depend on this are all failing. We have some code that looks like this:

class MyStepAdapter < Dry::Transaction::StepAdapters
  def initialize(input)
    # a little logic that we need
    # and then:

And when running Rails with Ruby 3.1, I get this error:

 Failure/Error: super

        wrong number of arguments (given 1, expected 0)

      # /usr/local/bundle/gems/dry-transaction-0.13.2/lib/dry/transaction/operation_resolver.rb:8:in `block (2 levels) in initialize'

I wonder if you have any plans to look into it or if I need to look into other options. Or could I be doing something wrong?

Thank you for your time reading this.


StepAdapters is just a Dry::Core::Container with sub-classes, why are you implementing initialize here? I don’t see that this class is ever actually initialized.

Thank you for the response! I’m going to check with the team to see why we’re implementing initialize. It looks like it only sets a few instance variables, perhaps to use during steps. I’ll see if we can refactor away from that approach.

We can close this. There was some confusion as to what the problem was; I suggested that we were subclassing Dry::Transaction::StepAdapters and overloading #initialize. The stacktrace actually pointed us to somewhere else in our codebase causing the issue. Thank you again for your time.

1 Like