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
Fixes #23918 - Find correct scope when updating taxonomy #5768
Conversation
Issues: #23918 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xprazak2 It looks like it fixes the issue with hammer but could you add a test? It is unclear to me how this broke and I'm afraid we will break it again.
Thank you!
@@ -88,7 +88,7 @@ def destroy | |||
|
|||
# overriding public FindCommon#resource_scope to scope only to user's taxonomies | |||
def resource_scope(*args) | |||
super.send("my_#{taxonomies_plural}") | |||
@resource_scope = scope_for(resource_class, args).send("my_#{taxonomies_plural}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be ||=
too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not see a reason why there is a ||=
in the first place, what if the cached data is stale?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
||=
seems to work here as well, so I made the change.
I added test and changed |
resource_scope caches the scope, on update the
@resource_scope
is[]
(no idea how that happens), butscope_for
fetches the correct scope.