-
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
Materialized path2 #571
Materialized path2 #571
Conversation
materialized path uses ancestry.nil? to be the root This puts that logic into a variable trying hard to remove the assumptions about the ancestry column: - ancestry.nil? means something - field is an empty string to mean no ancestors
Before: ancestry = root? ? nil : ancestor_ids.join("/") After: Implications: ancestry == "#{parent.ancestry}#{parent.id}/" # always query for my children/descendants no longer has an OR (big win) no more IS NULL sorting shenanigans
@d-m-u you have a comment on whether this is just adding complexity now or you think it moves us forward on allowing plug and play materialized path strategies? |
* added strategy: materialized_path2 stefankroes#571 * Added tree_view method stefankroes#561 (thx @Bizcho) * Fixed bug when errors would not undo callbacks stefankroes#566 (thx @daniloisr) * ruby 3.0 support * rails 7.0 support (thx @chenillen, @petergoldstein) * Documentation fixes (thx @benkoshy, @mijoharas)
I guess this one wasn't tested? It's not even loaded, you can't inherit a module ( |
Fixed most (all?) of the issues in this branch. In my opinion, the new strategy is better because it uses 1 condition instead of 2. |
Yea, I just found a few errors in here while I was refactoring something. Think it ends up with one too many slashes too I had run a bunch of tests on this but looks like I botched it when moving it across |
Waiting for you to approve this PR, and I'll send a fix for this one. |
This introduces another serialization technique for the ancestry column
Will probably be converting these methods over to helper methods that do not call
ancestry_column
, so I'm not sure if introducing this helps or just introduces more gook to change