Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.3k
Force scope on default filters collection#7511
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
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
ea831c1 toc3f8cb2Comparejavierjulio commentedMar 13, 2023
The tests are failing. Likely need some updates since this was last looked at. |
82e1817 to26e87edComparemgrunberg commentedAug 1, 2024
@javierjulio This is now a breaking change. |
codecovbot commentedAug 1, 2024 • 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.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@## master #7511 +/- ##======================================= Coverage 99.11% 99.11% ======================================= Files 141 141 Lines 4069 4087 +18 =======================================+ Hits 4033 4051 +18 Misses 36 36 ☔ View full report in Codecov by Sentry. |
a04b6ba toe8be50fComparethis should work even if default policy is not defined or does notdefine a default scope
e8be50f to0ffac23Comparemgrunberg commentedAug 1, 2024
@javierjulio took me some time to build a proper spec. Now is ready for review. |
javierjulio left a comment
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.
What is the benefit of adding this? If I understand right it only affects default filters, so if you set filters explicitly which is best, this would not apply. Or I guess it would since there is an update toadd_filter method. I'm not convinced on this change.
lib/active_admin/error.rb Outdated
| end | ||
| end | ||
| classScopeNotDefined <StandardError |
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'd like to include "Policy" in the error class name so it's clear since when I think "scopes" it's something else. Perhaps "PolicyScopeNotDefined" as the class name?
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 understand your concern with the name. I'm open to use another one. I just want to avoidPolicy because it's aPundit strong word. I want to model something more abstract, theActiveRecord::RecordNotFoundError forscope_collection method. I don't want to tailor the error for a specific AuthorizationAdapter implementation.
I renamed the class toScopeAuthorizationError. Is it better?
mgrunberg commentedAug 2, 2024
@javierjulio The change affects filters and default filters. I added more test scenarios to demonstrate the usage. I understand the previous commit was misleading. |
In-repo clone of#6923.
Fixes#6883.