Assuming I understand your classes right.. I was thinking something like this
def ancestors
(parent.present? ? [parent, parent.ancestors] :[]).flatten
end
If Parent is present, it returns an array consisting of parent and its ancestors. The flatten is required because each level adds a array layer.
Off topic. return
is considered bad style in ruby, and unless you need it, there is no need for this list to be a member variable.