Skip to content
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

Avoid extra scoping in delegating to klass methods in the scope block #33394

Merged
merged 1 commit into from
Jul 19, 2018

Conversation

kamipo
Copy link
Member

@kamipo kamipo commented Jul 19, 2018

Since #29301, delegating to klass methods in the scope block would
cause extra scoping by the receiver itself. The extra scoping would
always override intermediate scoping like unscoped and caused the
regression #33387. To keep the original scoping behavior, should avoid
the extra scoping in the scope block.

Fixes #33387.

Since rails#29301, delegating to klass methods in the `scope` block would
cause extra scoping by the receiver itself. The extra scoping would
always override intermediate scoping like `unscoped` and caused the
regression rails#33387. To keep the original scoping behavior, should avoid
the extra scoping in the `scope` block.

Fixes rails#33387.
@eileencodes eileencodes merged commit 01429a6 into rails:master Jul 19, 2018
eileencodes added a commit that referenced this pull request Jul 19, 2018
Avoid extra scoping in delegating to klass methods in the `scope` block
@eileencodes
Copy link
Member

Backported to 5-2-stable in eca9651

Thanks for the quick fix @kamipo!

@kamipo kamipo deleted the avoid_extra_scoping branch July 19, 2018 18:21
kamipo added a commit to kamipo/rails that referenced this pull request Nov 29, 2018
Follow up rails#33394.

rails#33394 only fixes the case of scoping with klass methods in the scope
block which invokes `klass.all`.
Query methods in the scope block also need to invoke `klass.all` to be
affected by the scoping.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants