Skip to content
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

Deprecate adding ancestry to the middle of an STI tree #626

Merged
merged 2 commits into from
Mar 11, 2023

Conversation

kbrock
Copy link
Collaborator

@kbrock kbrock commented Mar 11, 2023

This PR is also being merged into 4.3.x branch via #625 reverted


Added deprecation warnings for has_ancestry in the middle of an STI tree.

Still haven't thought up a good use case for why someone would define ancestry in the middle of an STI tree.

Due to the way it was introduce, it is possible that allowing has_ancestry in the middle of the tree was not an explicit goal but a side effect.

If we want to deprecate, need to put a warning into 4.3.x. Unsure if we will drop this functionality in 5.0 or 6.0.

The test helper has an implicit has_ancestry at the top level so it was masking the intent of the test. Whether we deprecate the feature or not, it is best to get this test into the code.


NOTE: as follow up, need to add deprecation for #617 but it looks like that may be invasive. may want to backport that PR and tweak it

kbrock added 2 commits March 10, 2023 15:22
the helper function `with_model` calls has_ancestry for us
So essentially we are calling this twice.

- fixed to not define has_ancestry at the root node.

This is now ensuring that search and the counter_caches are working.
Provide deprecation warning for has_ancestry in the middle of a tree

Still haven't thought up with a good use case for this.
@kbrock kbrock merged commit 0ba9506 into stefankroes:master Mar 11, 2023
@kbrock kbrock deleted the ancestry_sti_test branch March 11, 2023 02:13
@kbrock
Copy link
Collaborator Author

kbrock commented Mar 13, 2023

as hashed out in #620 we will keep this column for now. We can revisit at a later time to see if having all the base_ancesty_class references buys us something over the standard rails base_class

@kshnurov
Copy link
Contributor

What's the purpose of this deprecation? Makes zero sense.

@kbrock
Copy link
Collaborator Author

kbrock commented Mar 13, 2023

Agreed, I am putting together a PR that removes this deprecation and adds more tests on this case. Am waiting for 600 / 620 to go in.

I still wonder about the need for base_ancestry_class, but can address that at a later time.

I also need to remove the deprecation from 4-3-stable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants