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

Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call #268

Closed
gaetanm opened this issue Jan 29, 2021 · 4 comments

Comments

@gaetanm
Copy link

gaetanm commented Jan 29, 2021

Hello,

When I run Rspec on my project I have that warning:

ruby/gems/2.7.0/gems/arbre-1.4.0/lib/arbre/element.rb:182: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call

I guess the fix is to change

helpers.send(name, *args, &block)

to

helpers.send(name, *args, **kwargs, &block))

ActiveAdmin 2.9.0
Rails 6.0.3

@javierjulio
Copy link
Member

I would expect our tests to fail now that we have added Ruby 3.0 CI builds (pending merge) but they aren't. I don't see warnings on earlier version builds either. We likely don't have test coverage for this case. Were you able to determine where that was occurring and if so could you share what that code looked like? Could give a hint on how to create a reproducible test case. Thanks.

@amelie-certin
Copy link

Hello, I managed to reproduce it by doing so:

# helper
def foo(bar: 2)
  # Do something useful
end


  form do |f|
    f.input :name, hint: foo(bar: 1)
    ...
  end

Well, in our case we are using a helper to format a collection for a select, but it is all the same as long as the helper method takes a named parameter

@danny-lai-queo
Copy link

my server is flooded with that same warning . Is there any fix ?

I tried gaetanm 's suggestion to use
helpers.send(name, *args, **kwargs, &block) # with kwargs = {}

but it will crash and does not work .

@javierjulio
Copy link
Member

This was fixed in #318 and part of the latest release. Thanks!

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

4 participants