-
Notifications
You must be signed in to change notification settings - Fork 463
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
[Discussion] Drop ancestry_base_class #620
Conversation
b312cf3
to
ddc9840
Compare
/cc @Fryguy could you take a peek. With these changes, manageiq-core along with relationships work fine. Can you think of negative implications of changing this? |
ddc9840
to
8f7df9c
Compare
the helper function `with_model` calls has_ancestry for us So essentially we are calling this twice. The new test is calling has_ancestry in the middle. This is now ensuring that search and the counter_caches are working.
…meter, or primary_key These values do not change in an STI hierarchy
active_record defines base_class as the top of an STI tree. ancestry had a similar concept. It was the class where ancestry was defined. Since ancestry originally called it a base_class, there was a conflict and in 4e57f32 it was renamed to ancestry_base_class PRs of note: - stefankroes#86 - stefankroes#87 The ancestry_base_class is used quite often to make sure the proper class is accessed to lookup values. I'm not sure the use case for defining ancestry in the middle of a hierarchy, but it breaks a few things. If you define ancestry in the middle of a tree, the parent classes still implement all of ancestry. If these parent classes are added to the tree then the cache counters and finders will not work properly. I'm dropping this custom concept and using the standard rails concept instead, as I think it should have been done originally.
8f7df9c
to
9b30fc8
Compare
I can't really think of a valid reason. The only thing that comes to mind, and it feels way outside the norm, is if you want different has_ancestry settings for different subclasses from the same base class, but then I'd think you'd need multiple separate ancestry columns as well. |
@kshnurov do you have an opinion on this? |
will introduce some of the other #600 changes and then revisit this. I'm on the fence but leaning towards yes. |
This is a breaking change, right, so major version bump? (Or should we deprecate?) |
You're introducing a breaking change that adds/saves/solves nothing, but will break someone's use cases. |
A simple, "Lets keep this. there is an issue that states it is needed" would suffice. The phrase "I'm on the fence but leaning towards yes" means that I am unsure. That is why I reached out.
Don't be rude just to be rude. This adds nothing. Using something that rails has built in seemed to make sense over implementing something that is very close. And as I stated before, the mature in which this feature was introduced had me wondering if this feature was even intended behavior. |
You mentioned that issue in the PR description! I didn't expect you didn't even read it 🤦🏻♂️
You've thrown out my opinion, proposals and work a few times already without any objective reasoning. I consider that being rude, so the attitude is the result of that and a few new bad PRs that make this gem only worse. |
I'll revisit this later |
For my own reference
I guess I am stuck trying to figure out why someone would define an STI tree and only want to use part of it for an ancestry tree. Maybe there is a default scope in a portion of it? Also stuck having a concept that seems to overlap with rails so closely. (especially for a feature that I do not think is valid. would prefer to not have extra concepts in the code) Also concerned that the wrong class variables will be used or one will trample another. Put in a test to cover this (at least a little bit) I am only ever going to define this at the root level. So whether there is this variable does not affect me. |
active_record defines base_class as the top of an STI tree.
ancestry had a similar concept. It was the class where ancestry was defined.
Since ancestry originally called it a base_class,
there was a conflict and in 4e57f32 it was renamed to ancestry_base_class
PRs of note:
The ancestry_base_class is used quite often to make sure the proper class
is accessed to lookup values.
I'm not sure the use case for defining ancestry in the middle of a hierarchy,
but it doesn't seem to work in a reasonable manner. (UPDATE: the tests were faulty. I'm fixing the tests so it is properly tested)
I'm dropping this custom concept and using the standard rails concept
instead, as I think it should have been done originally.
Contemplating raising an error if a developer adds
has_ancestry
to a nonbase_class
.