-
Notifications
You must be signed in to change notification settings - Fork 21.7k
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
Prefix Module#parent, Module#parents, and Module#parent_name with module #34051
Prefix Module#parent, Module#parents, and Module#parent_name with module #34051
Conversation
I like this approach 👍 |
2f10932
to
e013117
Compare
e013117
to
c401c43
Compare
Prefix Module#parent, Module#parents, and Module#parent_name with module
`Module#parent_name is` deprecated in Rails 6.0. Ref: rails/rails#34051
I upgraded my rails
What is the recommended way to fix these? |
@cars10 reading the deprecation message it sounds like you have a |
I do not have any calls to
Edit: all deprecation warnings point to lines where |
Suppress DEPRECATION WARNING related this PR. rails/rails#34051
Suppress DEPRECATION WARNING related to [this changes](rails/rails#34051).
Suppress DEPRECATION WARNING related to [this changes](rails/rails#34051).
`parent_name` will be renamed `module_parent_name` in Rails 6.1, so it displays deprecation warnings on Rails 6.0. refs: rails/rails#34051
`parent_name` will be renamed `module_parent_name` in Rails 6.1, so it displays deprecation warnings on Rails 6.0. refs: rails/rails#34051
Prefix Module#parent, Module#parents, and Module#parent_name with module rails/rails#34051
Prefix Module#parent, Module#parents, and Module#parent_name with module rails/rails#34051
The |
rails/rails#34051 deprecated .parent in-favor of using .module_parent. This commit updates the code to use the new method, which should remove all of the deprecation warnings we are seeing when using rails v6.
…dule#module_parent` Rails 6 deprecated `Module#parent` and friends in rails/rails#34051, replacing them with a `module_*`-prefix naming scheme. This checks to see if `module_parent` is defined, using it if it's available.
Since Rails 6.0 the parent method is replaced with module_parent rails/rails#34051
Rails 6 deprecated `Module#parent` and friends in rails/rails#34051, replacing them with a `module_*`-prefix naming scheme. This checks to see if `module_parent` is defined, using it if it's available.
* silence deprecation warning from the rename of `Module#parent` to `Module#module_parent` Rails 6 deprecated `Module#parent` and friends in rails/rails#34051, replacing them with a `module_*`-prefix naming scheme. This checks to see if `module_parent` is defined, using it if it's available. * fix tests with hacky patch * comments * revert formatting changes * Fully support Rails 6.1 in tests * forgot to exclude several old versions of Ruby * fix indentation in blocks Big thanks to @andrew-newell Co-authored-by: Alex Robbin <agrobbin@gmail.com>
It changed in Rails with rails/rails#34051 and the old method has been deprecated and removed. This code should work with both Rails 5.2 and 6.1+
It changed in Rails with rails/rails#34051 and the old method has been deprecated and removed. This code should work with both Rails 5.2 and 6.1+
activesupport 6 has breaking change - parent* methods renamed to module_parent*. see rails/rails#34051
activesupport 6 has breaking change - parent* methods renamed to module_parent*. see rails/rails#34051
`parent` was needed to support Active Model < 6.1. Since the minimum required version is now 7.0, the conditional is not needed anymore Ref: rails/rails#34051 Close #12
Summary
Adds
module_
prefix toModule#parent
,Module#parents
, andModule#parent_name
.As discussed in #20901,
parents
isn't a blacklisted class attribute for model scopes. Using aparents
scope will result in aSystemStackError
.An alternate approach would be to disallow
parents
as a valid scope name, or find a better prefix thanmodule_
because it can include classes which are technically modules but could be better represented.I'll look into fixing call sites once we decide what the best course of action is.
r? @rafaelfranca
/cc @dhh, @sgrif