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

Postgres adapter passes keywords in a deprecated way (Ruby 2.7, ActiveRecord 6.1.4) #44307

Closed
hunter-moeller opened this issue Feb 1, 2022 · 6 comments

Comments

@hunter-moeller
Copy link

Steps to reproduce

Run the following ruby script with RUBYOPT='-W:deprecated'

require 'active_record'
require "active_record/connection_adapters/postgresql_adapter"

params = {:port=>5432}

ActiveRecord::Base.postgresql_connection(
  params
)

produces:

/Users/<redacted>/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/activerecord-6.1.4.4/lib/active_record/connection_adapters/postgresql_adapter.rb:78: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/Users/<redacted>/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/pg-1.3.1/lib/pg.rb:68: warning: The called method `connect' is defined here

Expected behavior

No deprecation warning.

Actual behavior

Shows deprecation warning.

System configuration

Rails version:
Active record 6.1.4.4

Ruby version:
2.7.4

@Edouard-chin
Copy link
Member

This can be closed, was fixed in #44346

@kamipo kamipo closed this as completed Feb 11, 2022
@rogermarlow
Copy link

This was merged to main on 8-Feb but is only in the v7 releases. It doesn't appear in the 6.1.x series which were released from 11-Feb, the latest being 6.1.5 on 10-Mar. Is there any chance this could be added to make a 6.1.6? Thanks!

@salbertson
Copy link

@rogermarlow did you find a way to use Rails 6.1.x and avoid the keyword argument warnings? It doesn't look like the adapter was changed in 6.1.6. https://github.com/rails/rails/blob/v6.1.6/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L78

@rogermarlow
Copy link

Hi @salbertson, no I didn't. Fortunately it only appears once when I run my test suite, but I would love to get rid of it as I try to keep a policy of zero warnings. (Broken windows and all that...)

bin/rails test
Running via Spring preloader in process 55217
/Users/rogermarlow/.rvm/gems/ruby-2.7.5/gems/activerecord-6.1.5/lib/active_record/connection_adapters/postgresql_adapter.rb:78: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/Users/rogermarlow/.rvm/gems/ruby-2.7.5/gems/pg-1.3.4/lib/pg.rb:68: warning: The called method `connect' is defined here
Run options: --seed 34110

# Running:

..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

Finished in 63.331504s, 10.8951 runs/s, 29.9535 assertions/s.
690 runs, 1897 assertions, 0 failures, 0 errors, 0 skips
Coverage report generated for Minitest to /Users/rogermarlow/github/recap/coverage. 4374 / 4652 LOC (94.02%) covered.

If someone could cut a v6.1.7 I'd be very grateful!

@eileencodes
Copy link
Member

I was going to comment on the PR but it will also be helpful to put this information here. The reason this didn't get backported to 6-1-stable at the time was because only 7.0.x is supported for bug fixes per our maintenance policy.

In general we're unlikely to be doing more releases of 6.1.x unless there's a security vulnerability. There was a bugfix release I did last week which was to fix something we broke in the previous security release. So while I can merge this change I can't promise it will be in a release anytime soon. It's probably a good time to prioritize upgrading to Rails 7.0.x and then Ruby 3.1.x.

@davegudge
Copy link

Thanks for the information @eileencodes.

We're in the process of actioning the deprecation warnings [whist running against Rails 6.1.x] in preparation to upgrade to Rails 7.0.x. I opened #45090 to action this deprecation warning so I could resolve it off my list, but I do appreciate that Rails 6.1.x is no longer supported for bug fixes as per the maintenance policy. If the PR gets merged and there's ever another 6.1.x release, that's great, but I'll make a note that this warning should not impact the upgrade to Rails 7.0.x.

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

No branches or pull requests

8 participants