Ensure that Hash and ActionController::Parameters are equal both ways.#23711
Ensure that Hash and ActionController::Parameters are equal both ways.#23711pschambacher wants to merge 1 commit intorails:masterfrom
Conversation
|
Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @schneems (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
|
I don't like modifying builtin classes like this. This will slow down hash equality comparison considerably around non-parameter equality comparisons. ActionController::Parameters is not a hash, so we should not expect it to be equal to one. If you were relying on this behavior before i would think wrapping it would be the best way forwards ActionController::Parameters.new(hash) == paramsOr simply params == hashWhile I agree that technically a == b should always be the same as b == a, i'm not sure the implementation merits the technical completeness. I would rather we deprecate the other behavior and give a warning |
|
Concur with @schneems - this seems unnecessary. I think it does make sense to possibly include a deprecation warning, which will be removed in 5.1. |
|
This will make migrating tests a big pain. |
|
Yes. Agree this change is unnecessary. Thank you for the pull request. |
Follow-up for #23167 by @maclover7
It fixed
ActionController::Parameters == Hashbut notHash == ActionController::Parameters.I think that
a == bshould be the same asb == aso here's a fix.The test failed without the
libchange.