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,
parentsisn't a blacklisted class attribute for model scopes. Using aparentsscope will result in aSystemStackError.An alternate approach would be to disallow
parentsas 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