You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wonder why there is no way to include the ancestors in the with_ancestor scope (see code below).
It is a really common use case for my project, so I started to ask myself if I am too stupid and don't see an obvious method to do that.
Let me explain a bit.
For example we have a group hierarchy with managers.
A manager can have multiple directly managed groups.
A manager can always manage all groups below a directly managed group, but lower groups can have
another manager too.
So if we have the constellation [1, 1.1, 1.1.2, 1.2] and user A is the direct manager of 1 and user B is manager of 1.1, A can manage all groups, and B can manage 1.1 and 1.1.2.
I wonder why there is no way to include the
ancestors
in thewith_ancestor
scope (see code below).It is a really common use case for my project, so I started to ask myself if I am too stupid and don't see an obvious method to do that.
Let me explain a bit.
For example we have a group hierarchy with managers.
A manager can have multiple directly managed groups.
A manager can always manage all groups below a directly managed group, but lower groups can have
another manager too.
So if we have the constellation
[1, 1.1, 1.1.2, 1.2]
and userA
is the direct manager of1
and userB
is manager of 1.1,A
can manage all groups, andB
can manage1.1
and1.1.2
.I know there are solutions. Like
Which isn't to bad but a bit annoying, since the instance methods have the
self_
feature (self_and_descendants
vsdescendants
).So my question, is there a reason, this has not been added or I am the only one needing it?
================================
Possible change to the gem:
The text was updated successfully, but these errors were encountered: