- Notifications
You must be signed in to change notification settings - Fork22.1k
Prefix Module#parent, Module#parents, and Module#parent_name with module#34051
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
dhh commentedOct 2, 2018
I like this approach 👍 |
2f10932 toe013117Comparee013117 toc401c43ComparePrefix Module#parent, Module#parents, and Module#parent_name with module
`Module#parent_name is` deprecated in Rails 6.0.Ref:rails/rails#34051
cars10 commentedMar 4, 2019
I upgraded my rails What is the recommended way to fix these? |
kaspth commentedMar 4, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@cars10 reading the deprecation message it sounds like you have a |
cars10 commentedMar 4, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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 modulerails/rails#34051
Prefix Module#parent, Module#parents, and Module#parent_name with modulerails/rails#34051
leastbad commentedJun 30, 2019
The |
rails/rails#34051 deprecated .parent in-favorof using .module_parent. This commit updates the code to use thenew method, which should remove all of the deprecation warnings weare seeing when using rails v6.
…dule#module_parent`Rails 6 deprecated `Module#parent` and friends inrails/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_parentrails/rails#34051
Rails 6 deprecated `Module#parent` and friends inrails/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 inrails/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 blocksBig thanks to @andrew-newellCo-authored-by: Alex Robbin <agrobbin@gmail.com>
It changed in Rails withrails/rails#34051 and the old methodhas been deprecated and removed. This code should work with bothRails 5.2 and 6.1+
It changed in Rails withrails/rails#34051 and the old methodhas been deprecated and removed. This code should work with bothRails 5.2 and 6.1+
activesupport 6 has breaking change - parent* methods renamed to module_parent*.seerails/rails#34051
activesupport 6 has breaking change - parent* methods renamed to module_parent*.seerails/rails#34051
`parent` was needed to support Active Model < 6.1.Since the minimum required version is now 7.0, the conditional is notneeded anymoreRef:rails/rails#34051Close#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