Add a flag to disable deprecated AC::Parameters comparison#44826
Add a flag to disable deprecated AC::Parameters comparison#44826tenderlove merged 1 commit intorails:mainfrom
Conversation
rafaelfranca
left a comment
There was a problem hiding this comment.
Let's make this a new default for Rails 7.1 by adding it here.
Also adding in the new framework default file https://github.com/rails/rails/blob/926b803297c4bc529ee46296a7cd5cc02bb21100/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_1.rb.tt.
And documenting the new config in https://github.com/rails/rails/blob/926b803297c4bc529ee46296a7cd5cc02bb21100/guides/source/configuring.md.
There was a problem hiding this comment.
We should talk about the config in this message.
There was a problem hiding this comment.
Thanks, added the following to the warning
To disable the deprecated behaviour set
`Rails.application.config.action_controller.allow_deprecated_parameters_hash_equality = false`.
The behavior of the comparison between hash and a `ActionController::Parameters` was changed and now will be deprecated. Check this Rails PR for more context rails/rails#44826.
* Add Rails 7.1 to appraisals * fix: Adjust validate options when managing columns and tables in migration This commit adjusts the way we manage columns and tables in migrations to account for the changes in Rails 7.1.0, it was introduced in this Rails version a validation around the options passed to tables and columns in migrations, so we need to adjust our code to skip this validation. This PR introduced this new validation on the migrations: rails/rails#46178 * Refine `ActiveRecord::SerializeMatcher` for Rails 7.1 compatibility This commit refines the `ActiveRecord::SerializeMatcher` to accommodate changes in the public API introduced in Rails 7.1. The `serialize` method's API has been updated, necessitating adjustments to our matcher specs to align with the new API. While this PR addresses the immediate need for compatibility, there is potential for further enhancements and refinements in the matcher's implementation to bring it in line with the revised public API. However, such improvements will be explored in a future PR. For reference, the changes in the public API can be found in the following PR: rails/rails#47463 This commit adjusts the `ActiveRecord::SerializeMatcher` the public API for the `serialize` method has changed on Rails 7.1, so we had to * feat: Upadte workflow matrix * fix: Adjust comparison between hash and `ActionController::Parameters` The behavior of the comparison between hash and a `ActionController::Parameters` was changed and now will be deprecated. Check this Rails PR for more context rails/rails#44826. * fix: Adjust usage of `has_secure_token` without a token attr The behaviour of this method was changed in Rails 7.1, and now it'll search for a `token` attr in the initialization of the record instead of the creation. To stay with the same behaviour as before it's necessary to pass a new argument `on: : create` to the method. * fix: Adjust specs for primary_key check * fix: Test updating error_highlight gem * fix: Add default Rails tables to acceptance spec This commit fixes the problem of not finding the tables when running the specs in eager load mode, this was introduced by Rails 7.1. Load the model schema when running test in eager load context rails/rails#49470
Summary
The PR #44812 added a deprecation for the comparison of AC::Params with Hashes.
The existing implementation can sometimes lead to the following bug:
Given a process where hashes of
AC::Parametersand equivalentHashcollidethe following happens:
Reads of the key with fetch (also delete, values_at) lead to all subsequent read operations of the key to return an array of raw Hashes.
The addition of the flag is going to allow affected users to turn off the deprecated implementation and avoid the bug without waiting for the next release cycle.