Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Integrate into Rails scopes #5

Open
wollistik opened this issue Apr 6, 2018 · 2 comments
Open

Integrate into Rails scopes #5

wollistik opened this issue Apr 6, 2018 · 2 comments

Comments

@wollistik
Copy link
Collaborator

The descendants/descendants_of methods are instance/class methods, which cannot be use when using scopes.
Find a way to allow things like

Node.where(foo: 'bar').descendants

instead of

Node.descendants_of(Node.where(foo: 'bar'))
@wollistik
Copy link
Collaborator Author

When this feature is implemented add a deprecation warning to switch over to new usage when an argument is passed to the class methods.

@wollistik wollistik changed the title Find a way to integrate into Rails scopes Integrate into Rails scopes Apr 14, 2023
@wollistik
Copy link
Collaborator Author

Solution found:
Using current_scope method of AR we can access the current relation when calling the method.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant