Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested transactions with step arguments fail with ArgumentError #125

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wintersolutions
Copy link

When calling a transaction from another transaction the call fails if step_args are provided.

Error message:

ArgumentError:
       wrong number of arguments (given 2, expected 0..1)
     # ./lib/dry/transaction/instance_methods.rb:25:in `call'

pseudocode:

nested = Class.new do
 include Dry::Transaction
 step :process
 def process(input, *args); Success; end
end.new

# register nested in container C

root = Class.new do
  include Dry::Transaction(container: C)
  step :root, with: nested
end.new

root.call # ok
root.with_step_args(root: 'foo').call # error

The issue seems to be that the arguments can't be passed down to the nested transaction but the lib tries to.

I've prepared a test case that demonstrates this in the pull request. It does not provide any solution to the issue yet.

Short discussion on discourse:

https://discourse.dry-rb.org/t/nested-transactions-with-step-arguments-buggy/757

@wintersolutions
Copy link
Author

See issue #124

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant