What I'm trying to do is get all the "public" pages indexed, and since that starts with the root elements of the tree that are in a particular scope, and then includes the published descendants of each public root, it gets complex from the perspective of ActiveRecord.
The thing that's missing in Ancestry's pre-baked scopes is something along the lines of "this node + all its descendants". Given a node, you can get all its descendants in one go, but then you have to add the parent to the list, and I've never found a pleasing way to do that and end up with a single association. That's why I end up with the sub-select in my example, where I find all the descendant_ids, concatenate the parent id, and the use `where id in (...)` to gather them into a single iterable object. I believe that union operations are coming in a future ActiveRecord, that could make this less long-hand, I suppose.
For now, I'll just have to add some comments for "future me" to read.
Walter