- Notifications
You must be signed in to change notification settings - Fork810
Add compatibility with Ruby 3#992
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
cla-checker-servicebot commentedApr 26, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
💚 CLA has been signed |
I have now read and signed the contributor agreement. |
I've updated the implementation to work on Ruby 2.4 through 3.0, based onthis ruby-core blog post, which should keep this change backwards-compatible. |
when the proxy fails to forward keywoard arguments, the error formethods that only accept keyword arguments looks like this:ArgumentError: wrong number of arguments (given 1, expected 0)
this resolves a bug with Rails 6.1 on Ruby 3, where keyword arguments are not forwarded and this causes an ArgumentError
since Ruby 1.9.2, about 12 years ago, you're supposed to define respond_to_missing? if you also define method_missing. there's more explanation in this blog post by a ruby committer in 2010:http://blog.marc-andre.ca/2010/11/15/methodmissing-politely/
d35acf3 tod9c062cCompareWhoops, I must have accidentally deleted the first line when I opened the file and not noticed. Fixed. |
therrick commentedSep 2, 2021
Any outlook on merging this? |
tiendo1011 commentedFeb 19, 2022
@picandocodigo can you release a new version that includes this fix? |
sebfie commentedFeb 22, 2022
I also need this fix ! Please can you release a new version? |
jonnynux commentedFeb 22, 2022
I upvote for releasing |
Version 7.2.1 has been released with these changes. |
mojobiri commentedMay 27, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Would it be possible to add this patch to the 6.x version? We are using Elasticsearch 6 and would love to have Ruby 3 support in 6.1.2 too. Right now we have to monkeypatch. |
dersnek commentedJan 20, 2024
|
Since Ruby 3 changed the way keyword arguments work, Rails now only accepts keyword arguments for
find_in_batches. Unfortunately, themethod_missingimplementation onElasticsearch::Model::Proxydoesn't proxy keyword arguments, so Rails now explodes. The error is triggered by callingModel.import, and looks something like this:The fix is to forward not just positional arguments, but also keyword arguments. This PR adds a test (failing before the patch), and a patch to forward keyword arguments.
Fixes#989,#977.