Rails 6.1 deprecation warnings
Rails 6.1 introduces breaking changes: https://edgeguides.rubyonrails.org/6_1_release_notes.html and some of them are warned about currently:
-
DEPRECATION WARNING: Accessing hashes returned from config_for by non-symbol keys is deprecated and will be removed in Rails 6.1. Use symbols for access instead. -
DEPRECATION WARNING: ActiveSupport::Multibyte::Chars#normalize is deprecated and will be removed from Rails 6.1. Use #unicode_normalize(:nfkd) instead. -
DEPRECATION WARNING: ActiveSupport::Multibyte::Unicode#normalize is deprecated and will be removed from Rails 6.1. Use String#unicode_normalize(:nfc) instead. (called from safe_title at /Users/tkuah/code/ee-gdk/gitlab/app/models/milestone.rb:265) -
DEPRECATION WARNING: ActiveSupport::Multibyte::Unicode#downcase is deprecated and will be removed from Rails 6.1. Use String methods directly. -
DEPRECATION WARNING: Dangerous query method (method whose arguments are used as raw SQL) called with non-attribute argument(s): "COUNT(*) DESC". Non-attribute arguments will be disallowed in Rails 6.1. This method should not be called with user-provided values, such as request parameters or model attributes. Known-safe values can be passed by wrapping them in Arel.sql().
A separate group of warnings related to default scoping:
-
DEPRECATION WARNING: Class level methods will no longer inherit scoping from deployed_to_cluster
in Rails 6.1. To continue using the scoped relation, pass it into the block directly. To instead access the full set of models, as Rails 6.1 will, useEnvironment.default_scoped
. -
DEPRECATION WARNING: Class level methods will no longer inherit scoping from create
in Rails 6.1. To continue using the scoped relation, pass it into the block directly. To instead access the full set of models, as Rails 6.1 will, useDesignManagement::Design.default_scoped
.' -
DEPRECATION WARNING: Class level methods will no longer inherit scoping from distinct_on_user_with_max_access_level
in Rails 6.1. To continue using the scoped relation, pass it into the block directly. To instead access the full set of models, as Rails 6.1 will, useMember.default_scoped
. -
DEPRECATION WARNING: Class level methods will no longer inherit scoping from create!
in Rails 6.1. To continue using the scoped relation, pass it into the block directly. To instead access the full set of models, as Rails 6.1 will, usePackages::Package.default_scoped
. -
DEPRECATION WARNING: Class level methods will no longer inherit scoping from outside_pipeline_family
in Rails 6.1. To continue using the scoped relation, pass it into the block directly. To instead access the full set of models, as Rails 6.1 will, useCi::Pipeline.default_scoped
. -
DEPRECATION WARNING: Class level methods will no longer inherit scoping from with_unique_issue_ids
in Rails 6.1. To continue using the scoped relation, pass it into the block directly. To instead access the full set of models, as Rails 6.1 will, useBackfillVersionAuthorAndCreatedAt::Version.default_scoped
.
Grepping the deprecations.zip may help to find a test that reproduces a warning, but please note that the warnings are represented as a multiline string. For example, the one about default scopes looks like the following in the file:
- 'DEPRECATION WARNING: Class level methods will no longer inherit scoping from `deployed_to_cluster`
in Rails 6.1. To continue using the scoped relation, pass it into the block directly.
To instead access the full set of models, as Rails 6.1 will, use `Environment.default_scoped`.'
Edited by Igor Drozdov