-
Notifications
You must be signed in to change notification settings - Fork 465
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
Siblings shouldn't return self #488
Comments
Performance wise, siblings is much simpler to program all of my parent's children. In many of the cases, this distinction doesn't matter to the code so taking this hit does not make sense. While I have heard people say "we are all siblings", referring to themselves, I tend to think that "my siblings" does not include myself. I do hear people use "other siblings" to be clear. I do worry about changing the definition of siblings - even in a major release. Do you like the idea of |
I think Agree that making a change to |
So then there would be a configuration on changing the definition for siblings? Not sure how to go about transitioning this and not screwing the existing users up |
Yeah it'd be a breaking change for sure. I'd deprecate it if I owned this gem. I absolutely love it other than this minor inconvenience. Beats recursive DB calls all day long |
just ran into this myself, I vote for deprecate. |
Maybe create a global configuration setting to change it. Or add a gem |
For now, you can use It seems like it would have a universal convention around this, but I haven't seen it. I did check It has been this way for so long I'm hesitant to change it. I have started to introduce global settings. |
Yup, I'm with you. Maybe just called out in the README since it feels like an unexpected anti-pattern. Feature switches could be a nice way to transition away from it. |
In the docs (and how the gem behaves), it states that the
siblings
scope will return all child nodes of the node's parent. Effectively the same as doing:node.parent.children
When you ask for siblings, you aren't asking for yourself. To achieve this we have to write it like this:
node.siblings.where.not(id: node.id)
.Not the worst thing in the world, but from a semantics perspective it feels definitively wrong.
The text was updated successfully, but these errors were encountered: