Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged

Conversation

@gmcgibbon
Copy link
Member

Summary

Addsmodule_ 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 disallowparents 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

@dhh
Copy link
Member

dhh commentedOct 2, 2018

I like this approach 👍

@gmcgibbongmcgibbonforce-pushed themodule_parent_method_rename branch frome013117 toc401c43CompareOctober 2, 2018 19:36
@rafaelfrancarafaelfranca merged commitc401c43 intorails:masterOct 2, 2018
rafaelfranca added a commit that referenced this pull requestOct 2, 2018
Prefix Module#parent, Module#parents, and Module#parent_name with module
ruby-bench-server pushed a commit to tgxworld/rails that referenced this pull requestOct 3, 2018
@gmcgibbongmcgibbon deleted the module_parent_method_rename branchOctober 5, 2018 20:31
y-yagi added a commit to y-yagi/rollbar-gem that referenced this pull requestJan 25, 2019
`Module#parent_name is` deprecated in Rails 6.0.Ref:rails/rails#34051
@cars10
Copy link

I upgraded my rails5.2.2 app to6.0.0.beta2 and every controller actions spams multiple of the following deprecation warnings:

.DEPRECATION WARNING: `Module#parent` has been renamed to `module_parent`. `parent` is deprecated and will be removed in Rails 6.1. (called from block in <class:ApplicationController> at /my/app/app/controllers/application_controller.rb:6)

What is the recommended way to fix these?

@kaspth
Copy link
Contributor

kaspth commentedMar 4, 2019
edited
Loading

@cars10 reading the deprecation message it sounds like you have aparent call on line 6 of your ApplicationController that need to be renamed tomodule_parent.

@cars10
Copy link

cars10 commentedMar 4, 2019
edited
Loading

I do not have any calls toparent in my entire project. Line 6 in my ApplicationController:

render json: {errors: 'Unauthorized'}, status: 401

Edit: all deprecation warnings point to lines whererender is called.
Edit2: i found the cause,active_model_serializers seems to be the cause. seerails-api/active_model_serializers#2316

kaspth, wasifhossain, nplusp, hiradyazdan, and remuspoienar reacted with thumbs up emoji

katsuma added a commit to katsuma/garage_client that referenced this pull requestApr 29, 2019
Suppress DEPRECATION WARNING related this PR.rails/rails#34051
katsuma added a commit to katsuma/garage_client that referenced this pull requestApr 29, 2019
Suppress DEPRECATION WARNING related to [this changes](rails/rails#34051).
katsuma added a commit to katsuma/garage_client that referenced this pull requestApr 29, 2019
Suppress DEPRECATION WARNING related to [this changes](rails/rails#34051).
sinsoku added a commit to sinsoku/dd-trace-rb that referenced this pull requestMay 8, 2019
`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
sinsoku added a commit to sinsoku/dd-trace-rb that referenced this pull requestMay 8, 2019
`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
suketa added a commit to suketa/rails_sandbox that referenced this pull requestJun 15, 2019
Prefix Module#parent, Module#parents, and Module#parent_name with modulerails/rails#34051
suketa added a commit to suketa/rails_sandbox that referenced this pull requestJun 16, 2019
Prefix Module#parent, Module#parents, and Module#parent_name with modulerails/rails#34051
@leastbad
Copy link
Contributor

Themarco-polo gem is also impacted by this deprecation. I created a fork that patches the function naming so as to suppress the warnings in console until such time as the upstream is updated.

https://github.com/pjforde1978/marco-polo.git

bwebster added a commit to stitchfix/stitches that referenced this pull requestSep 6, 2019
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.
agrobbin added a commit to agrobbin/rails-erd that referenced this pull requestSep 23, 2019
…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.
rubysamurai added a commit to rubysamurai/meta-rails that referenced this pull requestDec 14, 2020
PanosCodes added a commit to PanosCodes/mongoid that referenced this pull requestJan 5, 2021
Since Rails 6.0 the parent method is replaced with module_parentrails/rails#34051
yagince added a commit to yagince/erd that referenced this pull requestFeb 16, 2021
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.
kerrizor pushed a commit to voormedia/rails-erd that referenced this pull requestFeb 16, 2021
* 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>
kennyadsl added a commit to solidusio-contrib/solidus_searchkick that referenced this pull requestApr 22, 2021
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+
kennyadsl added a commit to solidusio-contrib/solidus_searchkick that referenced this pull requestApr 22, 2021
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+
senid231 added a commit to senid231/didww-v3-ruby that referenced this pull requestOct 22, 2021
activesupport 6 has breaking change - parent* methods renamed to module_parent*.seerails/rails#34051
senid231 added a commit to senid231/didww-v3-ruby that referenced this pull requestOct 26, 2021
activesupport 6 has breaking change - parent* methods renamed to module_parent*.seerails/rails#34051
tagliala added a commit to ifad/hawk that referenced this pull requestJun 15, 2024
`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
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

@rafaelfrancarafaelfranca

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@gmcgibbon@dhh@cars10@kaspth@leastbad@rafaelfranca

[8]ページ先頭

©2009-2025 Movatter.jp