-
Notifications
You must be signed in to change notification settings - Fork 59
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
filtering by (ransack) scopes does not work #42
Comments
first draft: see: master...easyPEP:feature/ransack-scopes what i like:
what i don't like:
to resolve that we could:
we can remove logic from the gem (
ressource = User.last
allowed_scopes = ['created_before']
ressource.class.send(:define_singleton_method, 'ransackable_scopes') do
allowed_scopes
end
User.ransackable_scopes
e.g.: jsonapi_filter(User.all, jsonapi_allowed_attributes, jsonapi_allowed_scopes, options)
...
def jsonapi_allowed_attributes
User.ransackable_attributes(current_user)
end
def jsonapi_allowed_scopes
User.ransackable_scopes(current_user)
end |
Hi there @fluxsaas and thanks for the issue 🙇 I'm a bit confused on what's not working tbh 🙈 I've been using ransackers for a while with no changes btw :) |
mh, maybe i have an error in my config i created a new branch with only the failing specs: if i run the tests i get some failing specs:
|
update replacing update 2: i enabled the github actions on my repository: https://github.com/easyPEP/jsonapi.rb/runs/2076179007?check_suite_focus=true |
@fluxsaas apologies for the late reply. I took a look at the PR you shared and I can see how that can be useful. Still, I'd like us to use the |
I confirm that |
Expected Behavior
filtering by scopes should work with jsonapi.rb and ransack, see: https://github.com/activerecord-hackery/ransack#using-scopesclass-methods
Actual Behavior
it seems not to work properly, only filtering by
allowed
attributes works.i created a branch and added failing tests:
master...easyPEP:feature/ransack-scopes
i would like to start working on a solution to make it work. do you have any specific recommendations?
The text was updated successfully, but these errors were encountered: