We have a hierarchical tree of X which this works well for but each leaf on that tree has_many Y relations and we need a way to recursively select all of the Y from all descendants of a particular instance x of X
So / in pseudocode
class X < ActiveRecord
belongs_to :parent, class_name: "X", optional: true, touch: true
has_many :children, inverse_of: :parent, class_name: "X", foreign_key: :parent
has_many :y
end
class Y < ActiveRecord
belongs_to :x
end
Then we would want
x = X.all.sample
ys = x.all_child_ys # this is all elements of Y which are in z.ys for all z which are of type X and children of x
Is there a way to do this now or some ( reasonable ) way to add it as a new feature ?
We have a hierarchical tree of
X
which this works well for but each leaf on that tree has_manyY
relations and we need a way to recursively select all of theY
from all descendants of a particular instancex
ofX
So / in pseudocode
Then we would want
Is there a way to do this now or some ( reasonable ) way to add it as a new feature ?