cloudflare
cloudflare copied to clipboard
Not compatible with ruby 3.X
Method arguments using **options is not valid in ruby 3.0 and as a result, we now get an error saying it expect 3 arguments instead of 4.
https://github.com/socketry/cloudflare/blob/master/lib/cloudflare/dns.rb#L78
More on this here: https://bugs.ruby-lang.org/issues/14183
zone.dns_records.create *** ArgumentError Exception: wrong number of arguments (given 0, expected 3)
ruby: 3.0.2 gem version 4.3.0
please help.
zone.dns_records.create
*** ArgumentError Exception: wrong number of arguments (given 0, expected 3)
Well, you are supplying zero arguments, and there are 3 non-optional arguments.
@ioquatix yes I did that in purpose in rails console to show the number of expected params when using ruby 3.0. It is supposed to be 4.
I already have a fix, I will do a PR soon.
We just ran into this, so far all our attempts return the same error – do you mind sharing your fix @julienchabanon
@sailing
Assuming options is a hash, instead of doing something like:
zone.dns_records.create('A', 'batman', '1.2.3.4', options)
You should now be doing something like:
zone.dns_records.create('A', 'batman', '1.2.3.4', **options)
Thanks @julienchabanon!
Sorry, I'll take a look at this code and fix it.