acts_as_recursive_tree icon indicating copy to clipboard operation
acts_as_recursive_tree copied to clipboard

Integrate into Rails scopes

Open wollistik opened this issue 6 years ago • 2 comments

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 avatar Apr 06 '18 09:04 wollistik

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 avatar Apr 14 '23 10:04 wollistik

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

wollistik avatar Apr 14 '23 10:04 wollistik