Fix and ban deprecation warning "Passing an ActiveRecord object"
What does this MR do and why?
This commit fixes the following deprecation warning
DEPRECATION WARNING: Passing an Active Record object to `quote` directly
is deprecated
It also bans this deprecation warning to avoid future instances.
Moreover, it also bans the deprecation warning proactively:
Passing an Active Record object to `type_cast` directly is deprecated
Please see #369970 (closed) for more information.
How to set up and validate locally
-
Revert the code change via
git checkout master -- lib/gitlab/object_hierarchy.rb
-
Run
bin/rspec --order defined spec/models/group_spec.rb -e ancestors
-
Observe failure
1) Group traversal queries linear behaves like namespace traversal #ancestors_upto with use_traversal_ids_for_ancestors_upto enabled includes ancestors upto but excluding the given ancestor
Failure/Error: connection.send(...)
ActiveSupport::DeprecationException:
DEPRECATION WARNING: Passing an Active Record object to `quote` directly is deprecated
and will be no longer quoted as id value in Rails 7.0.
(called from block in write_using_load_balancer at /home/peter/devel/gitlab/gdk/gitlab/lib/gitlab/database/load_balancing/connection_proxy.rb:120)
Shared Example Group: "#ancestors_upto" called from ./spec/support/shared_examples/namespaces/traversal_examples.rb:248
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Peter Leitzen