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

Bug with Ruby version 3.0 or above #15

Open
nathanstitt opened this issue Aug 28, 2023 · 1 comment
Open

Bug with Ruby version 3.0 or above #15

nathanstitt opened this issue Aug 28, 2023 · 1 comment

Comments

@nathanstitt
Copy link

Ruby 3 changed how hash arguments are handled in methods that use a splat for optional arguments.

This caused a bug with the overridden ActiveRecord::Base.transaction method because the original method has signature:
def transaction(**options, &block) but the aliased method has def transaction_with_retry(*objects, &block)

https://github.com/rails/rails/blob/6-0-stable/activerecord/lib/active_record/transactions.rb#L211`
https://github.com/qertoip/transaction_retry/blob/master/lib/transaction_retry/active_record/base.rb#L19

The error thrown appears as:

ArgumentError:
  wrong number of arguments (given 1, expected 0)
  # gems/3.0.0/gems/activerecord-6.1.7.6/lib/active_record/transactions.rb:208:in `transaction'

Since this library appears unmaintained, I've fixed the bug and forked for my teams use as openstax_transaction_retry here: https://github.com/openstax/transaction_retry The commit to fix was openstax@9184c88

@iagopiimenta
Copy link

I fixed it here: https://github.com/iagopiimenta/transaction_retry_continued

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

No branches or pull requests

2 participants